Professional Documents
Culture Documents
Corelated Subquery
Corelated Subquery
returned by sub-quries. but when come’s to co-related subqueries for every instance of parent
query subquery is executed and based on the result of sub-query the parent query will display
the record as we will have refernce of parent quries in su-queries we call these as corelated
subquries.
so, we can define co-related sub query as for every record retrival from the sub query is
processed and based on result of process the parent record is displayed.
The main differencre between subquery and co-related subquery is that in subquery child
query is executed first n then parent but in co-related subquery main query is executed
first(even though parenthesis are present) and then child query.
Example of co-related subquery for the emp and dept tables under Scott
-- The following query display the dept. name in which there are employess
-- The following query display the dept. name in which there is no employee.