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

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

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

#方法一: 嵌套子查询
select
    level,
    count(level) level_cnt
from (
    select
    t1.exam_id,
    level,
    tag
from (
    select
        exam_id,
        level
    from exam_record er
    left join user_info ui on er.uid= ui.uid
    where er.submit_time is not null
    and er.score > 80
)t1
left join examination_info ei on t1.exam_id = ei.exam_id
where tag = 'SQL'
)t2
group by level
order by level_cnt desc;

#方法二:
select
    ui.level,
    count(ui.uid) level_cnt
from user_info ui where uid in (
    select
        er.uid
    from examination_info ei 
    join exam_record er using(exam_id) 
    where ei.tag = 'SQL' and er.submit_time is not null  and er.score > 80
)group by level
order by level_cnt desc;

全部评论

相关推荐

生命诚可贵:先不说内容怎么样 排版就已经太差劲了 第一眼看不到重点,第二眼已经没有再看的耐心了, 篇幅占的太满了 字体不要用灰色 观感不好 想重点突出的黑色加粗就可以了 多列要点 少些大段的句子 项目经历把项目用的技术要点列出来,光写个python plc什么的太宽泛了 自我评价也有点偏多
点赞 评论 收藏
分享
03-04 17:52
已编辑
陕西师范大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务