题解 | #统计有未完成状态的试卷的未完成数和未完成率#

统计有未完成状态的试卷的未完成数和未完成率

https://www.nowcoder.com/practice/69fc2b1df4144c0991e4b8280d8aba27

select
	*
from (select
		exam_id,
    	sum(case
				when submit_time is null then 1
        	else 0
			end) as incomplete_cnt,
    	round(sum(case when submit_time is null then 1 else 0 end) /  count(*), 3) as 		complete_rate
	from exam_record
	group by exam_id
) t
where t.incomplete_cnt <> 0

全部评论

相关推荐

07-29 14:09
门头沟学院 Java
我爱o泡我爱o泡o泡果奶ooo
26加瓦鼠鼠:三个offer了,停手吧,回头是岸
点赞 评论 收藏
分享
点赞 评论 收藏
分享
投递地平线等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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