SUB QUERIES

From rbachwiki
Revision as of 20:13, 14 November 2017 by Bacchas (talk | contribs) (Created page with "A SUB QUERY is a query within a query which can return one or more rows SELECT * FROM SALES WHERE CUSTOMER_ID = (SELECT CUSTOMER_ID FROM CUSTOMER WHERE LAST_NAME = 'JOSEPH'...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A SUB QUERY is a query within a query which can return one or more rows

SELECT * FROM SALES
WHERE CUSTOMER_ID =
(SELECT CUSTOMER_ID FROM CUSTOMER WHERE LAST_NAME = 'JOSEPH'

A SUBQUERY executes first before the main query

SELECT * FROM SALES
WHERE CUSTOMER_ID IN  
(SELECT CUSTOMER_ID FROM CUSTOMER WHERE REGION ='SOUTH')

Back To Top- Home - Category