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

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

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

with N as(select distinct T.exam_id,D
 from(
    select exam_record.exam_id,timestampdiff(minute,start_time,submit_time) as D,dense_rank()over(partition by exam_id order by timestampdiff(minute,start_time,submit_time) desc) as R
    from exam_record
) as T
where R=2
group by exam_id,D)

,
 n as(select distinct t.exam_id,d
 from(

    select exam_record.exam_id,timestampdiff(minute,start_time,submit_time) as d,dense_rank()over(partition by exam_id order by timestampdiff(minute,start_time,submit_time)) as r
    from exam_record
) as t
where r=2)
select a.exam_id,duration,release_time
from (
    select examination_info.exam_id,duration,release_time,N.D-n.d as dt
    from examination_info
    inner join N
    on examination_info.exam_id=N.exam_id
    inner join n
    on N.exam_id=n.exam_id
    group by N.exam_id,N.D,n.d
    order by N.exam_id) as a
where dt>=duration/2
order by  a.exam_id desc

全部评论

相关推荐

11-13 14:37
门头沟学院 Java
程序员牛肉:是的,我觉得你最先需要的是多接触计算机圈子。我感觉你这个写的太幼稚了,根本没换位思考面试官。 你对实习的描述还是我写了前后端,我写了Restful接口,我用了EChatrs。你这让面试官怎么问你?问你什么是前后端?问你什么是Restful?讲真的兄弟,你这个简历在面试官眼里就是啥也不懂的好学生。所以一定要尽快加入一个圈子跟大家多聊聊,看看正儿八经的简历是怎么写的。 可以看一下我首页的简历怎么写那篇文章来学一下,你这里面的坑点我那篇文章里面都有讲过。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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