关键字说明:
-
row_number 排序值从小到大,依次排列
-
dense_rank 相同数据,并列保存,不存在断值(一直连续)
-
rank 相同数据并列保存,下一个值跳值(断续)
脚本示例:
SELECT *,
row_number() over(ORDER BY Salary desc) as 'row_number',
dense_rank() over(order by Salary desc) as 'dense_rank',
rank() over(order by Salary desc) as 'rank'
FROM Employee