题解 | #考试分数(三)#

考试分数(三)

https://www.nowcoder.com/practice/b83f8b0e7e934d95a56c24f047260d91

SELECT id, name, score
FROM (
    SELECT g.id, l.name, score, DENSE_RANK() OVER (PARTITION BY l.name ORDER BY score DESC) AS ranking 
    FROM grade g
    JOIN language l ON l.id = g.language_id 
) AS t
WHERE ranking <= 2
ORDER BY name, score DESC, id;

全部评论

相关推荐

11-28 17:48
中山大学 C++
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务