题解 | #作答试卷得分大于过80的人的用户等级分布#

作答试卷得分大于过80的人的用户等级分布

https://www.nowcoder.com/practice/5bc77e3a3c374ad6a92798f0ead4c744

SELECT u.level, count(u.level) level_cnt
FROM exam_record r
RIGHT JOIN examination_info i
ON r.exam_id = i.exam_id
RIGHT JOIN user_info u
ON u.uid = r.uid
WHERE r.score in (
    SELECT r.score
    FROM exam_record r
    RIGHT JOIN examination_info i
    ON i.exam_id = r.exam_id
    WHERE i.tag = 'SQL'
    AND r.score > 80
)
GROUP BY u.level
ORDER BY level_cnt DESC;

#sql学习日常#
全部评论

相关推荐

评论
点赞
收藏
分享
牛客网
牛客企业服务