RE: Dispaly employee records who gets more salary than the average salary in their department?
select b.ename b.deptno b.sal avg_salfrom (select ename deptno avg(sal) over (partition by deptno) avg_sal empno from emp) a emp bwhere a.empno b.empno and b.sal>a.avg_salorder by b.deptno;