学习时间:
2023年2月22日
题目描述:


题解分享:
# 作 者 : 繁 华 倾 夏
# 力扣(LeetCode):178. 分数排名
# MySQL 数据库
select a.Score as score,
(select count(distinct b.Score) from Scores b where b.Score >= a.Score) as 'rank'
from Scores a
order by a.Score desc
该篇文章分享了如何使用MySQL数据库解决LeetCode上的第178题,即实现分数排名功能。通过SQL查询,计算每个分数的排名,方法是找出比当前分数高的记录数量。文章提供了具体的SQL代码示例并进行了详细解释。


# 作 者 : 繁 华 倾 夏
# 力扣(LeetCode):178. 分数排名
# MySQL 数据库
select a.Score as score,
(select count(distinct b.Score) from Scores b where b.Score >= a.Score) as 'rank'
from Scores a
order by a.Score desc

被折叠的 条评论
为什么被折叠?