题解 | 灵活使用sum()统计函数

统计作答次数

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

# 使用sum()统计未作答完试卷次数,可理解为产生了一个新的列放入sum括号里面的条件判断值后再加和
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;

全部评论

相关推荐

爱吃烤肠的牛油最喜欢...:50K是ssp了估计,ssp的人家多厉害都不用说,每年比例大概在百分之5左右
点赞 评论 收藏
分享
不想上班的肱二头肌很...:简历一页,项目突出重点,自我评价可以删掉的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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