MSSQL ROW_NUMBER和RANK和DENSE_RANK的区别
作者:互联网
关键字说明:
-
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
标签:Salary,DENSE,over,NUMBER,rank,number,RANK,dense,row 来源: https://blog.csdn.net/shionlin2010/article/details/121796373