return the infornation that about the relative possition of record (ROW_NUMBER,Rank,DENSE_RANK) and allow to campare with succesor and precedessors when they sort in spacific order.
select ename, deptno, sal, hiredate, row_number() over ( partition by deptno order by sal desc, comm desc , hiredate desc ) sal_rank_in_dept, row_number() over (order by sal desc) sal_rank_overall from emp order by deptno , sal desc , comm desc , hiredate desc
If you have the better answer, then send it to us. We will display your answer after the approval.