Sort the result set tirst by salesperson name in alphabetic order 5. INNER JOIN+
ID: 3729331 • Letter: S
Question
Sort the result set tirst by salesperson name in alphabetic order 5. INNER JOIN+GROUP BY Scenario 5: The sales department of PVFC is conducting a product analysis to assess the sales performance for each of the PVFC product and product line. As a data analyst in the BI department, you are given the following three sets of requirements and asked to generate three result sets from the PVFD DB for the sales department. Requirement 5.1 For each customer, calculate the average ordered quantity and total ordered quantity Display customer ID, customer name and the calculated data but exclude customers who are living in UT or FL Sort the result set by the total ordered quantity in descending order SELECT c.Customer_ID, Customer Name, FROM Customer T AS c, Order_T AS o, Order_Line_T AS o WHERE C.Customer_ID AND AND Customer State GROUP BY c.Customer_ID, Customer_Name ORDER BY DESCExplanation / Answer
Select c.Customer_ID , Customer_Name, AVG(Quantity),SUM(Quantity) From Customer_T As c,Order_T AS o,Order_Line_T As ol WHERE c.Customer_ID = ol.Customer_ID AND ol.Order_ID = o.Order_ID AND Customer_State NOT IN ('UT','FL') GROUP BY c.Customer_ID,Customer_Name ORDER BY SUM(Quantity) DESC;
AVG and SUM aggregate functions are used for average and total quantity ordered by Customer. The common attributes of tables are matched .
Do ask if any doubt. Please upvote if answer is helpful.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.