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

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

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

with a as
(select distinct exam_id
from exam_record
where submit_time is null)

select exam_id,
count(case when submit_time is null then 1 else null end) as incomplete_cnt,
round(count(case when submit_time is null then 1 else null end)/count(*) ,3)
from exam_record
where exam_id in (select exam_id from a)

group by exam_id

全部评论
for 6.3
点赞 回复 分享
发布于 06-02 20:30 陕西

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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