题解 | #SQL类别高难度试卷得分的截断平均值#

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

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

select
uid
,exam_cnt
,if(question_cnt is null,0,question_cnt)
from
(select
uid
,count(submit_time) exam_cnt
FROM exam_record
where year(submit_time)=2021
group by uid) a
left join
(select
uid
,count(submit_time) question_cnt
FROM  practice_record
where year(submit_time)=2021
group by uid) b
using (uid)
where uid in
(select
uid
from user_info
join exam_record
using (uid)
join examination_info
using (exam_id)
where tag='SQL'
and level=7
and difficulty='hard'
group by uid
having avg(score)>=80)
order by exam_cnt,question_cnt desc
这里一定要year=2021,就算不打也是正确的,但无法保存通过。
全部评论

相关推荐

无情咸鱼王的秋招日记之薛定谔的Offer:好拒信,偷了,希望有机会用到
点赞 评论 收藏
分享
11-15 17:19
湖南大学 Java
成果成果成果果:这是哪个公司的hr,这么离谱吗,我没见过用性别卡技术岗的,身边女性同学拿大厂offer的比比皆是
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务