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

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

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

select answ.exam_id,duration,release_time from 
    (select ans.exam_id,max(ans_time) - min(ans_time) as ans_time_diff from
        (select examination_info.exam_id,timestampdiff(minute,start_time,submit_time) as ans_time,
        row_number() over (partition by examination_info.exam_id order by timestampdiff(minute,start_time,submit_time) desc) as ans_time_rank
        from exam_record join examination_info using(exam_id)
        where submit_time is not null ) ans
    where ans_time_rank != 1 and  ans_time_rank != -1
    group by ans.exam_id) answ
join examination_info using(exam_id)
where ans_time_diff > duration / 2
order by answ.exam_id desc
全部评论

相关推荐

不愿透露姓名的神秘牛友
03-19 10:38
实力求职者:真的绷不住了,第一张霸总人设,第二张求生欲拉满
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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