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

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

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

with t1 as (select
  exam_id,
  timestampdiff(minute,start_time ,submit_time)  as x1,         
  row_number() over (partition by exam_id  order by timestampdiff(minute,start_time ,submit_time) desc)
  as second_slow,
  row_number() over (partition by exam_id  order by timestampdiff(minute,start_time ,submit_time) )
  as second_qucik,
  duration,
  release_time        
from exam_record
join examination_info
using(exam_id)
where score is not null)

select exam_id,t2.duration,t2.release_time
from(
        select *
        from t1
        where second_slow=2 ) as t2
left join (
        select *
        from t1
        where second_qucik=2 ) as t3
using(exam_id)

where  (t2.x1-t3.x1)>=t2.duration/2
group by exam_id
order by exam_id desc
全部评论

相关推荐

不愿透露姓名的神秘牛友
06-19 17:02
鼠鼠深知pdd的强度很大,但是现在没有大厂offer,只有一些不知名小厂我是拒绝等秋招呢,还是接下?求大家帮忙判断一下!
水中水之下水道的鼠鼠:接了再说,不图转正的话混个实习经历也不错
投递拼多多集团-PDD等公司10个岗位 >
点赞 评论 收藏
分享
在开会的单身狗很有一套:学院本被想着这么快有面试,而且简历废话太多了 那些在校经历什么荣誉什么的企业不关心
点赞 评论 收藏
分享
牛客928043833号:在他心里你已经是他的员工了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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