Tuesday 13 August 2019

Analytical SQL: Rank Vs Dense Rank

Rank Vs Dense Rank

select e.*, rank() over( order by salary desc) from employees e;
-- rank returned as 1,2,3,3,5



select e.*, dense_rank() over( order by salary desc) from employees e;
-- rank returned as 1,2,3,3,4


No comments:

Post a Comment