Master query:

SELECT 
   ORDER_ID, 
   ORDER_DATE, 
   ORDER_TOTAL, 
   ORDERS.CUSTOMER_ID, 
   SALES_REP_ID, 
   C1.CUST_FIRST_NAME, 
   C1.CUST_LAST_NAME, 
   C1.CUST_ADDRESS, 
   C1.CUSTOMER_ID, 
   C2.CUST_FIRST_NAME, 
   C2.CUST_LAST_NAME, 
   C2.CUST_ADDRESS, 
   C2.CUSTOMER_ID 
FROM ORDERS, CUSTOMERS C1, CUSTOMERS C2 
WHERE ORDERS.CUSTOMER_ID = C1.CUSTOMER_ID AND 
   ORDERS.SALES_REP_ID = C2.CUSTOMER_ID 



Detail query:

SELECT 
   O.ORDER_ID, 
   O.LINE_ITEM_ID, 
   O.PRODUCT_ID, 
   O.QUANTITY, 
   O.UNIT_PRICE, 
   TRANSLATED_DESCRIPTION, 
   P.PRODUCT_ID, 
   O.QUANTITY * O.UNIT_PRICE 
FROM ORDER_ITEMS O, PRODUCT_DESCRIPTIONS P 
WHERE  O.PRODUCT_ID = P.PRODUCT_ID 
   AND P.LANGUAGE_ID = 'US' 



Formula column:

function CF_DUE_DATEFormula return Date is 
today date; 
begin 
 select sysdate into today from dual; 
  return today + 30; 
end; 