题解 | #第二快/慢用时之差大于试卷时长一半的试卷# 居然只有十行代码

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

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

with t as (select *,timestampdiff(second,start_time,submit_time) time,row_number() over(partition by exam_id order by timestampdiff(second,start_time,submit_time)) rank1 
,row_number() over(partition by exam_id order by timestampdiff(second,start_time,submit_time) desc) rank2
from exam_record
where submit_time is not null)
select t1.exam_id,duration,release_time from (
select * from t where rank1=2) t1  join (
select * from t where rank2=2) t2 using(exam_id)
left join examination_info e using(exam_id)
where t2.time-t1.time > e.duration * 0.5 *60
order by exam_id desc











全部评论

相关推荐

07-15 11:41
门头沟学院 Java
点赞 评论 收藏
分享
牛客83700679...:简历抄别人的,然后再投,有反馈就是简历不行,没反馈就是学历不行,多投多改只要技术不差机会总会有的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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