What is correlated sub-query?
What is correlated sub-query?In a simple SubQuery, the result retrieved by the inner query is fed to the outer query. The outer query takes the result as its input and processes it to produce its output.
However, in a corelated sub query, a correlated sub-query is dependent upon the outer query.
The outer query and the sub-query are related typically through a WHERE statement located in the sub-query.
The sub query gives a reference to the outer query. Then the outer query executes and the result is returned to the sub query. Finally the sub query is executed for every row that is selected by the outer query