Which of the following queries will return the name of the customer who placed the highest amount of orders and the total order amount?

Consider the exhibit given below:

Which of the following queries will return the name of the customer who placed the highest amount
of orders and the total order amount?

Consider the exhibit given below:

Which of the following queries will return the name of the customer who placed the highest amount
of orders and the total order amount?

A.
SELECT CUSTOMER, MAX(UNITPRICE*QUANTITY) AS “TOTAL”
FROM ORDERS
GROUP BY CUSTOMER
/

B.
SELECT CUSTOMER, SUM(UNITPRICE*QUANTITY) AS “TOTAL”
FROM ORDERS
WHERE SUM(UNITPRICE*QUANTITY)=
(SELECT MAX(SUM(UNITPRICE*QUANTITY))
FROM ORDERS
GROUP BY CUSTOMER)
GROUP BY CUSTOMER
/

C.
SELECT CUSTOMER, SUM(UNITPRICE*QUANTITY) AS “TOTAL”
FROM ORDERS
GROUP BY CUSTOMER
HAVING SUM(UNITPRICE*QUANTITY)=
(SELECT MAX(SUM(UNITPRICE*QUANTITY))
FROM ORDERS
GROUP BY CUSTOMER)
/

D.
SELECT CUSTOMER, SUM(UNITPRICE*QUANTITY) AS “TOTAL”
FROM ORDERS
GROUP BY CUSTOMER
HAVING SUM(UNITPRICE*QUANTITY)=
(SELECT SUM(UNITPRICE*QUANTITY)
FROM ORDERS
GROUP BY CUSTOMER)
/



Leave a Reply 0

Your email address will not be published. Required fields are marked *