题解 | #统计作答次数#
统计作答次数
http://www.nowcoder.com/practice/45a87639110841b6950ef6a12d20175f
total_pv 行数
complete_pv 提交时间不为null——考察聚合函数逻辑判断
complete_exam_cnt 提交时间不为null,对exam_id去重——考察select中的子查询
select count(*) total_pv, sum(submit_time is not null) complete_pv, (select count(distinct exam_id) from exam_record where submit_time is not null) complete_exam_cnt from exam_record