Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ie send CTRL-ALT-DEL + Disconnect Auto hide SQL Worksheet History 0.026 ID, (DI

ID: 3733447 • Letter: I

Question

ie send CTRL-ALT-DEL + Disconnect Auto hide SQL Worksheet History 0.026 ID, (DI ID) AS OF ),2) AS ROUND (SUM (PROFIT),2) AS TOTAL PROF FROM ORDER ITEMS OI, ORDERS O WHERE OI.ORDER ID 0.ORDER ID GROUP BY ROLLUP ID) ORDER BY OMBER OF ORDERS: Saipt Output x Error starting at line : 22 in command - SELECT CUSTOMER ID, COONT (DSTINCT .ORDER ID) AS "KMBER OF ORDERS.. ROOND ( ROUND (SUM (PROFIT),2) AS TOTAL PROFIT FROM ORDER ITEMS o1, ORDERS O WHERE OZ ORDER ID -O.ORDER TD GROUP BY ROLLUP (CUSTOMER ID) ORDER BY NUMBER OF ORDERS" Error at Cormand Line : 23 Column : e Error report - SQL. Error: ORA-00923: FROM keyword not found where expected 00923. o0000FROM keyword not found wheze expected *Cause: Action:

Explanation / Answer

What I can see from the query is you are missing one comma in the field list in SELECT clause after "Total Sales".

Putting a comma will resolve the issue.

The correct query would be-

SELECT CUSTOMER_ID, COUNT(DISTINCT O.ORDER_ID) AS "NUMBER OF ORDERS",

ROUND(SUM(SALES),2) AS "TOTAL SALES",

ROUND(SUM(PROFIT),2) AS "TOTAL PROFIT"

FROM ORDER_ITEMS OI, ORDERS O

WHERE OI.ORDER_ID = O.ORDER_ID

GROUP BY ROLLUP(CUSTOMER_ID)

ORDER BY "NUMBER OF ORDERS";