
Note: Outputs of the said SQL statement shown here is taken by using Oracle Database 10g Express Edition Output: ORD_NUM ORD_AMOUNT ADVANCE_AMOUNT ORD_DATE CUST_C AGENT_ ORD_DESCRIPTION DES_NU DES_DATE DES_AMOUNT ORD_NUM ORD_DATE ORD_AMOUNT AGENT_CODEĢ00117 800 200 20-OCT-08 C00014 A001 D003 25-OCT-17 20-OCT-08 800 A001 ON orders.agent_code = despatch.agent_code The following SQL statement can be used : SELECT * FROM orders 'agent_code' of 'orders' table should be equal to the 'agent_code' of 'despatch' table for joining, largest (maximum) 'ord_date' should be equal to the 'ord_date' of ' orders' table,ģ. 'ord_date' should be largest(maximum) from the 'orders' table,Ģ. To get all columns from 'orders' and 'despatch' table after joining, with the following condition -ġ. The following SQL statement can be used : SELECT agent_code, ord_date, cust_code 'agent_code' of 'orders' table must be equal to the 'agent code' of 'ord_date' will be equal to the maximum 'ord_date' of 'orders' table with following condition. To get data of 'agent_code', 'ord_date' and 'cust_code' from the 'orders' table with the following conditions. The following SQL statement can be used : SELECT agent_code, MAX(ord_date) AS "Max Date" To get data of 'agent_code' and maximum 'ord_date' with an user defined column alias 'Max Date' for each agent from the orders table with the following condition. Output: ORD_NUM ORD_AMOUNT ORD_DATE AGENT_CODE

SELECT MAX(ord_date) FROM orders WHERE agent_code='A002')

The following SQL statement can be used : SELECT ord_num, ord_amount, ord_date, agent_code

maximum 'ord_date' from those agents whose 'agent_code' is 'A002', 'ord_date' is equal to the maximum 'ord_date',Ģ. To get data of 'ord_num', 'ord_amount', 'ord_date', 'agent_code' from the 'orders' table with the following conditions -ġ. To get the maximum 'ord_date' from the 'orders' table, the following SQL statement can be used : SELECT MAX (ord_date) AS "Max Date"
