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

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

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

select exam_id,duration,release_time
from (
    select er.exam_id,duration,release_time,submit_time,start_time,
    (row_number() over (partition by er.exam_id order by timestampdiff(minute,submit_time,start_time) desc)) as ranking_slow,
    (row_number() over (partition by er.exam_id order by timestampdiff(minute,submit_time,start_time))) as ranking_fast
    from examination_info as ei,exam_record as er
    where er.exam_id=ei.exam_id and submit_time is not null
) as r
where (case when r.ranking_slow=2 then timestampdiff(minute,submit_time,start_time) else 0 end - 
    case when r.ranking_fast=2 then timestampdiff(minute,submit_time,start_time) else 0 end)>0.5*duration 
order by exam_id desc;

全部评论

相关推荐

offer多多的六边形战士很无语:看了你的博客,感觉挺不错的,可以把你的访问量和粉丝数在简历里提一下,闪光点(仅个人意见)
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务