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

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

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


select uid,exam_cnt,if(question_cnt is null,0,question_cnt)
from
# table 1
(SELECT uid,count(submit_time) as exam_cnt
from exam_record 
where year(submit_time)=2021
group by uid) as table1
left join 
#table 2
(select uid,count(submit_time) as question_cnt
from practice_record
where year(submit_time)=2021
group by uid) as table2
using(uid)
where uid in ( #挑选哪些uid符合条件
              select uid 
              from exam_record left join user_info using(uid)
              left join examination_info using(exam_id)
              where tag = 'SQL' and level=7
              group by uid
              having avg(score)>80
)
order by exam_cnt,question_cnt desc

全部评论

相关推荐

点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-08 13:15
点赞 评论 收藏
分享
06-05 19:46
已编辑
武汉大学 后端
点赞 评论 收藏
分享
07-05 16:23
门头沟学院 Java
mengnankk:我投了300,约了5 6个面试。感觉项目写的太多了。一个项目就写五六个亮点,不是把整个项目的功能描述下。其他的没啥,简历看起来有点长
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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