Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Important fields that will be needed ( to save space I used abbreviations that should NOT be used in actual programming ) : tblCustomer: CustomerNumber
Important fields that will be needed to save space I used "abbreviations" that should NOT be used in actual programming:
tblCustomer:
CustomerNumber I put it as
"CustNum" JUST for this exam
SalesRepNumber I put it as "RepNum"
JUST for this exam
tbISIsrep:
SalesRepNumber I put it as "RepNum" JUST for this exam
CommissionRate I put it as "ComRate"
for this exam
SQL Display the average balance name it AvgBal for those states so display state whose average balance is higher than the average balance of all customers. Display also the average of the whole table under the header AllAvg.
tableSELECT AVGBalanceAVGBalanceAVGBalanceAVGBalancetableASAvgBal,,State, SELECT,AVGBalancetableAS AvgBal, State,SELECT AVGBalancetableAS AvgBal, State, AsAVGBalance AS AllAvg,AtableAS AvgBal, State,AVGBalance AS AllAvgFROM tblCustomer ASFROM tblCustomer ASFROM tblCustomer,tableFROM tblCustomerGROUP BY StatetableAllAvgFROM tblCustomerAllavg,GROUP BY Sta,HAVING AvgBalGROUP BY State,tableFROM tblCustomerGROUP BY StatetableAVGBalance;AVIFROM tblCustomer;HAVING AVGBalancetableHAVING AVGBalance AllAvg;tableSELECT AVGBalanceFROM tblCustomer;
SQL List those sales reps who started working for the company before their manager.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started