题解 | #考试分数(三)#
考试分数(三)
https://www.nowcoder.com/practice/b83f8b0e7e934d95a56c24f047260d91
select g1.id, a.name, g1.score from grade as g1 inner join language as a on g1.language_id=a.id where ( select count(distinct g2.score) from grade as g2 where g1.language_id=g2.language_id and g2.score>=g1.score )<=2 order by a.name asc, g1.score desc, g1.id asc # 使用where子查询:思想与内连接类似,不过也是一种思路。我们可以知道的是,一般可以使用where子查询的题目,同样可以使用内连接代替 # #
三种解题方式: