How to display the names of the employees who earn highest salary in their respective departments?

Oracle Apps Interview QuestionsCategory: SQLHow to display the names of the employees who earn highest salary in their respective departments?
Questions Master asked 10 years ago

How to display the names of the employees who earn highest salary in their  respective departments?

1 Answers
Shailender Thallam Staff answered 10 years ago

SELECT ename,
  sal,
  deptno
FROM emp
WHERE sal IN
  (SELECT MAX(sal) FROM emp GROUP BY deptno
  );