用dense_rank排名,可以处理并列情况并且不会跳排名

select emp_no, salary, 
dense_rank() over (order by salary desc) as ranking
from salaries

通过计算有多少salary不小于当前salary来计算排名

select s1.emp_no, s1.salary, 
(select count(distinct salary) 
 from salaries 
 where salary >= s1.salary) as ranking
 from salaries as s1
 order by s1.salary desc, s1.emp_no