LeetCode刷题实战178:分数排名
程序IT圈
共 1198字,需浏览 3分钟
·
2021-02-08 14:05
Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecutive integer value. In other words, there should be no "holes" between ranks.
题意
解题
SELECT score,
dense_rank() over(ORDER BY score DESC) as `Rank`
FROM scores;
评论