Saturday 12 July 2014

Multicolumn Subquery



Display the employee details who are earning maximum salaries of each department.

   
SELECT * FROM EMP WHERE(DEPNO,SAL) IN
(
SELECT DEPTNO,MAX(SAL) FROM EMP GROUP BY DEPTNO
);

Note:Here subquery plays an important role.
The columns in the subquery must be present in the WHERE clause of the outer query.

No comments:

Post a Comment