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

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

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

相关推荐

jack_miller:我给我们导员说我不在这里转正,可能没三方签了。导员说没事学校催的时候帮我想办法应付一下
点赞 评论 收藏
分享
10-30 22:18
已编辑
毛坦厂中学 C++
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务