题解 | #第二快/慢用时之差大于试卷时长一半的试卷#

第二快/慢用时之差大于试卷时长一半的试卷

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

select
    t1.exam_id,
    ei.duration,
    ei.release_time  
from (
    select
        exam_id,
        row_number() over(partition by exam_id order by timestampdiff(second,start_time,submit_time) desc) rk1,
        row_number() over(partition by exam_id order by timestampdiff(second,start_time,submit_time) asc) rk2,
        timestampdiff(second,start_time,submit_time) time
    from exam_record
    where score is not null
)t1
join examination_info ei on t1.exam_id = ei.exam_id
group by t1.exam_id
having (max(if(rk1=2,t1.time,0) - if(rk2=2,t1.time,0)))/60 > ei.duration/2
order by t1.exam_id desc

全部评论

相关推荐

缒梦&独舞:这家公司是这样的,去年给我实习offer了,不过也是面着玩儿的,他周六还要去做公益志愿活动
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务