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

分别满足两个活动的人

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


with table1 as (
    select uid, score , 
    timestampdiff(minute, start_time , submit_time ) as timediff , difficulty,duration
    from exam_record left join examination_info using(exam_id)
    where year(submit_time) = 2021
),
# activity1
table2 as (
    select uid , min(score) , 'activity1' as activity
    from table1
    group by uid ,activity
    having min(score) >= 85
),
# activity2
table3 as (
    select uid,max(score), 'activity2' as activity 
    from table1
    where difficulty = 'hard' and timediff < 0.5 * duration  # 难度为hard 且 一半时间
    group by uid, activity
    having max(score) >= 80
)
select uid,activity
from table2

union all 
 
select uid,activity
from table3
subquery
order by uid, activity

全部评论

相关推荐

头像
11-07 01:12
重庆大学 Java
精致的小松鼠人狠话不多:签哪了哥
点赞 评论 收藏
分享
Bug压路:老哥看得出来你是想多展示一些项目,但好像一般最多两个就够了😂页数一般一页,多的也就2页;这些项目应该是比较同质化的,和评论区其他大佬一样,我也觉得应该展示一些最拿手的(质量>数量)😁😁😁专业技能部分也可以稍微精简一些
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务