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

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

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

select 
exam_id,
count(case when score is null then 1 else null end) incomplete_cnt,
format(count(case when score is null then 1 else null end)/count(id),3) incomplete_rate
from exam_record
group by exam_id
having incomplete_cnt>0

全部评论

相关推荐

点赞 评论 收藏
分享
刘湘_passion:出国旅游?那就小心你的腰子咯
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务