题解 | #统计有未完成状态的试卷的未完成数和未完成率#
统计有未完成状态的试卷的未完成数和未完成率
http://www.nowcoder.com/practice/69fc2b1df4144c0991e4b8280d8aba27
select exam_id
,count(case when score is null then 1 else null end) as incomplete_cnt
,ROUND(count(case when score is null then 1 else null end)/count(*),3)
as incomplete_rate
from exam_record
group by exam_id
having incomplete_rate<>0