SQL - Structured Query Language

Co-related Subquery



Co-related subquery is used execute repeatedly, once for each row that might be selected by the outer query. Correlated subquery can declare in WHERE clause expression only. The following query is used to find out department wise maximum salary getting Employee Information.

-- Example 53 --

 

USE EBusiness

GO

 

SELECT * FROM EMP E      

WHERE Salary = (SELECT MAX(Salary) FROM EMP WHERE EMP.Dept_Code = E.Dept_Code)


Query Output Screen



* * * * *


Email Your Comment To AUTHOR