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

分别满足两个活动的人

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

#activity1要求每次考试分数都要85以上,若最低的为85,则后面每次都会比他高
select uid,"activity1" as activity
from exam_record
where year(submit_time)="2021"
group by uid
having min(score)>=85

union all

select distinct uid,"activity2" as activity
from examination_info as ei
join exam_record as er
on ei.exam_id=er.exam_id
where year(er.submit_time)="2021"
and ei.difficulty="hard"
and timestampdiff(minute,start_time,submit_time)*2<ei.duration
and er.score>80

order by uid

全部评论

相关推荐

伟大的烤冷面被普调:暨大✌🏻就是强
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务