Oracle三种排名函数使用
1) SELECT s.*,Row_Number() OVER (partition by c_name ORDER BY grade desc) rank FROM score s
2) SELECT s.*,rank() OVER (partition by c_name ORDER BY grade desc) rank FROM score s
3)
SELECT s.*,dense_rank() OVER (partition by c_name ORDER BY grade desc) rank FROM score s
总结: row_number()over() 正常顺序 1 2 3 4 5
dense_rank() OVER() 非跳跃排序 1 1 1 2 3
rank()over() 跳跃排序 1 1 1 4 5