What is Correlated Sub query in Sql?

It is very similar to sub-queries where the parent query is executed based on the values 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.

In this query main query will executes first. sub query will depends on the main query. It fallows top down approach.

In normal sub queries sub query will executes first. It fallows down to top approach.

A subquery that references a column in the outer statement. The inner query is executed for each candidate row in the outer statement.

1 comment:

Sekar said...

Hi, This material is very useful one. Thanks for your post. Keep posting technical stuff.