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

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

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
全部评论

相关推荐

07-25 10:53
门头沟学院 Java
投递简历一星期多了,一直卡在第一个环节没进展是不是已经没戏了
Peter____G...:其他大厂都过了,甚至在字节实习了,但是莉莉丝简历依旧秒挂
投递莉莉丝游戏等公司7个岗位
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-30 13:52
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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