题解 | #分别满足两个活动的人#

分别满足两个活动的人

https://www.nowcoder.com/practice/a126cea91d7045e399b8ecdcadfb326f

SELECT * from (SELECT uid,'activity2' activity from (
SELECT er.*,ei.tag,ei.difficulty,ei.duration,TIMESTAMPDIFF(second,start_time,submit_time) subtime FROM `exam_record` er join examination_info ei on er.exam_id=ei.exam_id
where score >80 and ei.difficulty='hard'
)t1 
where subtime<=duration*60/2  
union 
SELECT distinct uid,'activity1' activity from exam_record where score>=85 GROUP BY uid HAVING MIN(score)>=85
)t2
ORDER BY uid,activity;

#正确做法:按照分组最小值>80筛选出每一次答题都大于80分的uid
SELECT distinct uid,'activity1' activity from exam_record where score>=85 GROUP BY uid HAVING MIN(score)>=85

全部评论

相关推荐

10-28 11:04
已编辑
美团_后端实习生(实习员工)
一个2人:我说几个点吧,你的实习经历写的让人觉得毫无含金量,你没有挖掘你需求里的 亮点, 让人觉得你不仅打杂还摆烂。然后你的简历太长了🤣你这个实习经历看完,估计没几个人愿意接着看下去, sdk, 索引这种东西单拎出来说太顶真了兄弟,好好优化下简历吧
点赞 评论 收藏
分享
10-21 23:48
蚌埠坦克学院
csgq:可能没hc了 昨天一面完秒挂
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务