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

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

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

select
    level,
    count(distinct u.uid) as level_cnt
from
    exam_record as er
    left join examination_info as ei on er.exam_id = ei.exam_id
    left join user_info as u on er.uid = u.uid
where
    u.uid in (
        select
            u.uid
        from
            exam_record as er
            left join examination_info as ei on er.exam_id = ei.exam_id
            left join user_info as u on er.uid = u.uid
        where score > 80
    )
and tag = 'SQL'
group by level
order by level_cnt desc, level desc

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务