Last active
February 22, 2020 10:14
-
-
Save Cvetomird91/609c0c9d1b0f6e066d5b4c1a653b1f77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM CUSTOMERS, ORDERS, ORDER_ITEMS | |
WHERE CUSTOMERS.CUSTOMER_ID = ORDERS.CUSTOMER_ID and ORDERS.ORDER_ID = ORDER_ITEMS.ORDER_ID; | |
SELECT CUSTOMERS.FNAME, CUSTOMERS.LNAME, count(distinct ORDERS.ORDER_ID) Orders, sum(ORDER_ITEMS.UNIT_PRICE * ORDER_ITEMS.QUANTITY) FROM CUSTOMERS, ORDERS, ORDER_ITEMS | |
WHERE CUSTOMERS.CUSTOMER_ID = ORDERS.CUSTOMER_ID and ORDERS.ORDER_ID = ORDER_ITEMS.ORDER_ID group by CUSTOMERS.FNAME, CUSTOMERS.LNAME order by 4 desc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment