题解 | #满足条件的用户的试卷完成数和题目练习数#

满足条件的用户的试卷完成数和题目练习数

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

with temp_table as (
    select
        distinct t1.uid
    from
        user_info t1,
        examination_info t2,
        exam_record t3
    where
        t1.uid = t3.uid
        and t2.exam_id = t3.exam_id
        and t2.tag = 'SQL'
        and t2.difficulty = 'hard'
        and year(t3.submit_time) = 2021
        and t1.level = 7
    group by
        t1.uid
    having  
        avg(t3.score) > 80)

select 
    t_3.uid,
    exam_cnt,
    ifnull(question_cnt,0) as question_cnt
from
    (select 
        t3.uid,
        count(*) as exam_cnt
    from
        exam_record t3
    where
        year(t3.submit_time) = 2021
        and t3.uid in (select * from temp_table)
    group by
        t3.uid) t_3
left join
    (select 
        t4.uid,
        count(*) as question_cnt
    from
        practice_record t4
    where
        year(t4.submit_time) = 2021
        and t4.uid in (select * from temp_table)
    group by
        t4.uid) t_4
on
    t_3.uid = t_4.uid
order by
    exam_cnt,question_cnt desc

全部评论

相关推荐

qq乃乃好喝到咩噗茶:院校后面加上211标签,放大加粗,招呼语也写上211
点赞 评论 收藏
分享
Southyeung:我说一下我的看法(有冒犯实属抱歉):(1)简历不太美观,给我一种看都不想看的感觉,感觉字体还是排版问题;(2)numpy就一个基础包,机器学习算法是什么鬼?我感觉你把svm那些写上去都要好一点。(2)课程不要写,没人看,换成获奖经历;(3)项目太少了,至少2-3个,是在不行把网上学习的也写上去。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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