LeetCode刷题实战178:分数排名
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;
赞 (0)