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

分别满足两个活动的人

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

select
    uid,
    'activity1' as activity
from
    exam_record as t1
    inner join examination_info as t2 on t1.exam_id = t2.exam_id
where
    year (t1.start_time) = 2021
group by
    uid
having
    min(t1.score) >= 85
union
select
    uid,
    'activity2' as activity
from
    exam_record as t1
    inner join examination_info as t2 on t1.exam_id = t2.exam_id
where
    year (t1.start_time) = 2021
    and t2.difficulty = 'hard'
    and t1.score > 80
    and timestampdiff (second, t1.start_time, t1.submit_time) <= (t2.duration * 60) / 2
group by
    uid
order by uid;

全部评论

相关推荐

01-27 15:41
门头沟学院 Java
想躺平的菜鸡1枚:我项目比你难、学历比你好、还有SCI论文,投java都被拒一大片,现在基本上都要问点agent开发
软件开发投递记录
点赞 评论 收藏
分享
01-30 16:13
浙江大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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