Tuesday, May 24, 2011

DENSE_RANK

--- USE OF DENSE_RANK
--- SHOWS THE RANKING OF THE RECORD IN A GROUP, RESENT FOR EACH GROUP

select ename , deptno, sal,
dense_rank() over (partition by deptno order by sal desc) salary_rank,
sum(sal) over (partition by deptno) total_salary
from SCOTT.EMP
order by deptno

No comments:

Post a Comment