How to display those managers name whose salary is more than average salary of his employee?

Oracle Apps Interview QuestionsCategory: SQLHow to display those managers name whose salary is more than average salary of his employee?
Questions Master asked 10 years ago

How to display those managers name whose salary is more than average salary of his employee?

1 Answers
Shailender Thallam Staff answered 10 years ago

SELECT DISTINCT emp.ename
FROM emp,
  emp e
WHERE e.sal <
  (SELECT AVG(emp.sal) FROM emp WHERE emp.empno=e.mgr GROUP BY emp.ename
  )
AND emp.empno=e.mgr;