A correlated sub-query is a sub-query that uses values from the outer query in its WHERE clause. The sub-query is evaluated once for each row processed by the outer query.
For Example :-
Select * from EmployeeDetails e
Where Salary = ( Select MAX(Salary) From EmployeeDetails
Where DeptNo = e.DeptNo)
Here if outer query return 10 rows,the inner query will be executed 10 times.
No comments:
Post a Comment