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

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

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

with t as( 
        select *,
            timestampdiff(second,start_time,submit_time) as delta_t,
            row_number() over(partition by exam_id
                     order by  timestampdiff(second,start_time,submit_time) ) ranking_min,     
            row_number() over(partition by exam_id
                         order by  timestampdiff(second,start_time,submit_time) desc) ranking_max
        from exam_record
        where submit_time is not null
)

select ei.exam_id,duration,release_time
from examination_info ei
join (
    select exam_id,
           delta_t 
    from t
    where ranking_min = 2
) min_t
using(exam_id)
join(
    select exam_id,
           delta_t 
    from t
    where ranking_max = 2
) max_t
using(exam_id)
where (max_t.delta_t - min_t.delta_t) > duration*60/2
order by ei.exam_id desc




全部评论

相关推荐

不愿透露姓名的神秘牛友
07-02 18:35
简历上把1个月实习写成了3个月,会进行背调吗?
码农索隆:一个月有一个月的实习经历,三个月有三个月的实习经历
点赞 评论 收藏
分享
点赞 评论 收藏
分享
湫湫湫不会java:先投着吧,大概率找不到实习,没实习的时候再加个项目,然后把个人评价和荣誉奖项删了,赶紧成为八股战神吧,没实习没学历,秋招机会估计不多,把握机会。或者说秋招时间去冲实习,春招冲offer,但是压力会比较大
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
今天 11:35
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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