PERCENT_RANK()
每行按照公式(rank-1) / (rows-1)進行計算。其中,rank為RANK()函數產生的序號,rows為當前窗口的記錄總行數
CUME_DIST()
分組內小於、等於當前rank值的行數 / 分組內總行數
SELECT id, score , rank() OVER (ORDER BY score DESC) AS 'rank' , dense_rank() OVER (ORDER BY score DESC) AS 'dense_rank' , row_number() OVER (ORDER BY id DESC) AS 'row_number' , row_number() OVER (partition by score ORDER BY id DESC) AS 'row_number1' , PERCENT_RANK() OVER (ORDER BY score DESC) AS 'PERCENT_RANK' , CUME_DIST() OVER (ORDER BY score) AS 'CUME_DIST' , CUME_DIST() OVER (PARTITION BY score ORDER BY id) AS 'CUME_DIST1' FROM scores order by id
https://blog.csdn.net/Hzfeng666/article/details/109612895