Oracle : What is a CO-RELATED SUBQUERY?

A CO-RELATED SUBQUERY is one that has a correlation name as table or view designator in the FROM clause of the outer query and the same correlation name as a qualifier of a search condition in the WHERE clause of the subquery.
eg
SELECT field1 from table1 X
WHERE field2>(select avg(field2) from table1 Y
where
field1=X.field1);


(The subquery in a correlated subquery is revaluated for every row of the table or view named in the outer query.)

No comments:

Post a Comment