SELECT TO_CHAR(SALES_DATE,'YYYY') YEAR, TO_CHAR(SALES_DATE,'Q') Q, TOTAL_SALE_AMOUNT FROM CUSTOMER_SALE ORDER BY TO_CHAR(SALES_DATE,'YYYY'), TO_CHAR(SALES_DATE,'Q')
YEAR Q TOTAL_SALE_AMOUNT ---- - ----------------- 1999 1 40.45 1999 3 52.66 1999 4 61.9 2000 1 108.03 2000 1 20.47
SELECT P.PRODUCT_ID, P.PRODUCT_NAME, S.SALE_AMOUNT FROM PRODUCT P, SALE_ITEM S WHERE P.PRODUCT_ID = S.PRODUCT_ID ORDER BY P.PRODUCT_ID
PRODUCT_ID PRODUCT_NAME SALE_AMOUNT ---------- ------------------------------ ----------- 2 Box Turtle 15.5 3 Fish Tank 24.95 4 Dog Food 5.15 4 Dog Food 5.15 8 Canary 29 10 Bird Food 3.5 14 Chew Toy 6.5 14 Chew Toy 6.5 15 Catnip 1.99 16 Bird Treat 4.5 18 Dog Collar 5.65 20 Kitty Package 55 21 Puppy Package 78
SELECT UPDATED_BY_USER, LAST_UPDATE_DATE FROM PRODUCT P
The result looks like this: UPDATED_BY_USER LAST_UPDA ------------------------------ --------- JANET MARK 11-JUN-99 JANET 10-MAY-99 JANET 21-SEP-99 MARK 15-SEP-99 JANET 01-JUL-99 MARK 30-OCT-99 JANET 28-FEB-99 MARK 15-APR-99 JANET 23-OCT-99 MARK 24-NOV-99 JANET 01-JAN-00 HENRY 22-FEB-00 MARK 15-DEC-99 JANET 19-NOV-99 MARTIN 30-MAY-99 MARTIN 14-JUL-99 MARTIN 14-JUL-99 HENRY 11-JUN-99 JANET 14-OCT-99 MARTIN 29-AUG-99 MARTIN 25-AUG-99 MARTIN 05-AUG-99 MARTIN 05-AUG-99 MARTIN 05-AUG-99 JANET 15-JUL-99
SELECT C.CUST_ID, C.LASTNAME, C.STATE, TOTAL_SALE_AMOUNT FROM CUSTOMER C, CUSTOMER_SALE CS WHERE C.CUST_ID = CS.CUST_ID
CUST_ID LASTNAME ST TOTAL_SALE_AMOUNT --------- ------------------------- -- ----------------- 1 Black NE 108.03 25 Redding HI 40.45 26 Lee CA 52.66 1 Black NE 61.9 26 Lee CA 20.47
GROUP BY