题解 | #SQL15 统计作答次数#

统计作答次数

http://www.nowcoder.com/practice/45a87639110841b6950ef6a12d20175f

方法一:子查询

select count(start_time) total_pv,
count(submit_time) complete_pv,
(
    select count(distinct(exam_id)) from exam_record where submit_time is not null
) complete_exam_cnt
from exam_record;

方法二:

select count(start_time) total_pv,
count(submit_time) complete_pv,
count(distinct(exam_id) and submit_time is not null)
from exam_record;
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务