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

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

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

Select exam_id, duration, release_time
from examination_info
where exam_id in (
    Select exam_id
    from(
    Select exam_id, timediff(min(td),max(td)) as diff, duration
    from (
    Select exam_id , td, duration
    from (
    Select er.exam_id, uid, timediff(start_time, submit_time) as td, duration, 
    row_number() over(partition by er.exam_id order by timediff(start_time, submit_time) DESC ) as subtimeDESC_rank, row_number() over(partition by er.exam_id order by timediff(start_time, submit_time) ASC ) as subtimeASC_rank
    from exam_record er left join examination_info ei on er.exam_id = ei.exam_id
    where submit_time is not null 
    ) t1
    where  subtimeDESC_rank = 2 or subtimeASC_rank = 2 ) t2
    group by exam_id
    having minute(diff) >= duration/2 ) t3
)
    order by exam_id desc

全部评论

相关推荐

想按时下班的我在等o...:我投测试也是这个情况,不知道咋办了
点赞 评论 收藏
分享
05-26 16:13
门头沟学院 C++
牢大肘击Java:海投就完事了bro,就当刷视频了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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