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

分别满足两个活动的人

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

with
    temp as (
        select
            exam_id,
            uid,
            timestampdiff(second, start_time, submit_time) / 60 as spend_time,
            # (submit_time - start_time) / 60 as spend_time,
            score,
            tag,
            difficulty,
            duration
        from
            exam_record
            join examination_info using (exam_id)
        where
            year(start_time) = 2021
    )
select distinct
    uid,
    "activity1" as activity
from
    temp
where
    score >= 85
union all
select distinct
    distinct uid,
    "activity2" as activity
from
    temp
where
    spend_time <= 0.5 * duration
    and difficulty = 'hard'
    and score > 80

    order by uid 

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-09 12:30
点赞 评论 收藏
分享
07-01 13:37
门头沟学院 Java
steelhead:不是你的问题,这是社会的问题。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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