题解 | #统计作答次数#

统计作答次数

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

select
    count(1) as total_pv,
    sum(
        case
            when a.submit_time is not null
            and a.score is not null then 1
            else 0
        end
    ) as complete_pv,
    count(
        distinct case
            when a.submit_time is not null
            and a.score is not null then a.exam_id
            else null
        end
    ) as complete_exam_cnt
from
    exam_record a

你爱用if用if哈,我是不怎么喜欢if。因为以前遇到过很多复杂条件,if用着是真难受。

全部评论

相关推荐

06-12 16:00
天津大学 Java
牛客30236098...:腾讯坏事做尽,终面挂是最破防的 上次被挂了后我连简历都不刷了
点赞 评论 收藏
分享
07-18 14:55
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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