select salary from
(select *, dense_rank over(order by salary desc) as sal) from employee as e
where e.sal=5;
Dense rank will assign ranks according to the descending order of the salary. If the salary of two employee are same, it will give the same rank and will not skip the next number.
Answers ( 2 )
select salary from
(select *, dense_rank over(order by salary desc) as sal) from employee as e
where e.sal=5;
Dense rank will assign ranks according to the descending order of the salary. If the salary of two employee are same, it will give the same rank and will not skip the next number.
Select first_name, salary, s.salary_rank from (
select *, dense_rank() over(order by salary) as salary_rank from salary) s
where s.salary_rank = 5
Select first_name, salary from salary
order by salary desc
limit 1 offset 4;
Using window function dense_rank enables us to display the rank as well in the output.