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

分别满足两个活动的人

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

select uid,'activity1' activity from exam_record er
join examination_info ei
on er.exam_id=ei.exam_id
where uid not in (select uid from exam_record where score<85) and year(start_time)=2021
union
select uid,'activity2' activity from exam_record er
join examination_info ei
on er.exam_id=ei.exam_id
where timestampdiff(second,start_time,submit_time)<=duration*30 and score>80 and difficulty='hard'
and year(start_time)=2021
order by uid;

成绩全部大于等于85,只要uid不在有一个成绩小于85的组中就行

timestampdiff(unit,begin,end),返回end-begin的结果,单位为unit(如second,minute等)

全部评论

相关推荐

10-24 11:10
山西大学 Java
若梦难了:哥们,面试挂是很正常的。我大中厂终面挂,加起来快10次了,继续努力吧。
点赞 评论 收藏
分享
过往烟沉:我说什么来着,java就业面就是广!
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务