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

分别满足两个活动的人

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

select 

    t1.uid      as uid ,

    'activity1' as activity

from exam_record t1

where year(t1.submit_time) = 2021

group by t1.uid

having min(t1.score) >= 85

#****

union all 

select 

    distinct t1.uid as uid ,  # 至少有一次

    'activity2'     as activity

from           exam_record t1 

left join examination_info t2

    on t1.exam_id = t2.exam_id

where year(t1.submit_time) = 2021

    and t2.difficulty = 'hard'

    and t1.score > 80

    and ( t2.duration - timestampdiff(minute, t1.start_time, t1.submit_time) ) > (t2.duration / 2 )

order by uid

/*SQL*/;

全部评论

相关推荐

05-24 14:12
门头沟学院 Java
点赞 评论 收藏
分享
06-13 10:15
门头沟学院 Java
想去夏威夷的大西瓜在...:我也是27届,但是我现在研一下了啥项目都没有呀咋办,哎,简历不知道咋写
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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