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

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

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

学到了一个新聚合函数nth_value()

with temp as
(select exam_id, 
nth_value(timestampdiff(second, start_time, submit_time), 2) 
 over(partition by exam_id
      order by timestampdiff(second, start_time, submit_time) desc) - 
nth_value(timestampdiff(second, start_time, submit_time), 2) 
 over(partition by exam_id
      order by timestampdiff(second, start_time, submit_time)) as time_diff
from exam_record)

select distinct exam_id, duration, release_time FROM
examination_info join temp using(exam_id)
where time_diff > duration * 60 / 2

order by exam_id desc
全部评论

相关推荐

小浪_Coding:找硬件测试,也可兼顾软测欧, 简历还可以的 ,注意排版,项目写的有条理一点, 然后个人技能多加点, 润色好简历之后就开始沟通海投了,深圳,东莞这边做硬件相关的公司还不少, 医疗类,仪器类的都可以尝试
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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