Tuesday, May 24, 2022

Query to find the third highest salary


We can used dens_rank() function to find the rank of salaries of employees and then put in a subquery to get rank is equal to 3.  


select * from( select ename, sal, dense_rank() over(order by sal desc)r from Employee) where r=3;



No comments:

Post a Comment

Query to find the third highest salary

We can used dens_rank() function to find the rank of salaries of employees and then put in a subquery to get rank is equal to 3.   select * ...