-- Customer by Order --
SELECT distinct c.CUSTOMER_ID , initcap(C.CUST_FIRST_NAME || ' ' || C.CUST_LAST_NAME) Name, o.ORDER_ID, O.ORDER_TOTAL
FROM DEMO_CUSTOMERS C, DEMO_ORDERS O, DEMO_ORDER_ITEMS I
where C.CUSTOMER_ID = O.CUSTOMER_ID and
I.ORDER_ID = O.ORDER_ID
-- Customer by Product --
SELECT distinct c.CUSTOMER_ID , initcap(C.CUST_FIRST_NAME || ' ' || C.CUST_LAST_NAME) Name, p.product_id, P.PRODUCT_DESCRIPTION
FROM DEMO_CUSTOMERS C, DEMO_ORDERS O, DEMO_ORDER_ITEMS I, DEMO_PRODUCT_INFO P
where C.CUSTOMER_ID (+) = O.CUSTOMER_ID and
I.ORDER_ID = O.ORDER_ID and
I.PRODUCT_ID = p.product_id
-- Customer by Order and Product --
SELECT distinct c.CUSTOMER_ID , initcap(C.CUST_FIRST_NAME || ' ' || C.CUST_LAST_NAME) Name, i.order_item_id, p.product_id, P.PRODUCT_DESCRIPTION
FROM DEMO_CUSTOMERS C, DEMO_ORDERS O, DEMO_ORDER_ITEMS I, DEMO_PRODUCT_INFO P
where C.CUSTOMER_ID (+) = O.CUSTOMER_ID and
I.ORDER_ID = O.ORDER_ID and
I.PRODUCT_ID = p.product_id (+)
-- Customer By Order & Non Order --
SELECT c.CUSTOMER_ID, initcap(C.CUST_FIRST_NAME || ' ' || C.CUST_LAST_NAME) Name, min(O.ORDER_ID) Order_id
FROM DEMO_CUSTOMERS C, DEMO_ORDERS O
where C.CUSTOMER_ID = O.CUSTOMER_ID (+)
group by c.CUSTOMER_ID, C.CUST_FIRST_NAME, C.CUST_LAST_NAME order by c.customer_id