how to find record having 5th highest salary in a table?

Analytics
N/A

how to find record having 5th highest salary in a table?

how to find record having 5th highest salary in a table?
3 REPLIES

Re: how to find record having 5th highest salary in a table?

Hi Preeti,

Try using Rank on your salary field to get that. You can try the following query :

SELECT EMP_NO,SALARY,RANK(SALARY)
FROM
EMP
QUALIFY RANK(SALARY) = 5;

Try this and let me know if this works...

Thanks,
Arun

Re: how to find record having 5th highest salary in a table?

this will give u any highest salary from the table

select * from (select ename,deptno,sal,dense_rank() over (partition by deptno order by sal desc) n from emp2) where n=&n;

Re: how to find record having 5th highest salary in a table?

this will give u any highest salary from the table

select * from (select ename,deptno,sal,dense_rank() over (partition by deptno order by sal desc) n from emp2) where n=&n;