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

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

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

select exam_id,duration,release_time from examination_info where exam_id in (
	SELECT exam_id from (
	SELECT exam_id,
	duration,
	sum(case when rk1=2 then time1 else 0 end)-sum(case when rk2=2 then time1 else 0 end) as count1 from (
	
	SELECT exam_id,time1,duration,
	ROW_NUMBER() over(partition by exam_id order by time1 desc) as rk1,
	ROW_NUMBER() over(partition by exam_id order by time1 asc) as rk2
	from (
	select er.*,timestampdiff(second,start_time,submit_time) as time1,ei.duration,ei.release_time from exam_record er join examination_info ei 
on er.exam_id=ei.exam_id
	
	)t1
	)t2 group by exam_id
	)t3
	 where count1>duration*30) order by exam_id desc;
	 这题目实在是有点困难

全部评论

相关推荐

死在JAVA的王小美:哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈,我也是,让我免了一轮,但是硬气拒绝了
点赞 评论 收藏
分享
喜欢走神的孤勇者练习时长两年半:池是池,发是发,我曾池,我现黑
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务