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

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

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

select
uu.uid,
count(distinct a.id) as exam_cnt,
count(distinct b.id) as question_cnt
from (
select distinct t2.uid from user_info as t1 join exam_record as t2 using(uid) join examination_info as t3 using(exam_id) 
where t1.level = 7 
and t3.tag = 'SQL' 
and t3.difficulty = 'hard'
group by t1.uid having avg(t2.score) > 80 
) as uu left join exam_record as a on uu.uid = a.uid and year(a.submit_time) = 2021 left join practice_record as b on uu.uid = b.uid and year(b.submit_time) = 2021
group by uu.uid
order by exam_cnt asc,question_cnt desc

全部评论

相关推荐

代码飞升:别用口语,后端就写后端,前端就写前端,最后别光后悔
点赞 评论 收藏
分享
05-14 20:34
门头沟学院 Java
窝补药贝八股:管他们,乱说,反正又不去,直接说680
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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