题解 | #统计有未完成状态的试卷的未完成数和未完成率#

统计有未完成状态的试卷的未完成数和未完成率

https://www.nowcoder.com/practice/69fc2b1df4144c0991e4b8280d8aba27

with data_f_use as (
    select exam_id
        , count(start_time) as start_cnt
        , count(submit_time) as complete_cnt    
    from exam_record
    group by exam_id
)
    select exam_id
        , start_cnt - complete_cnt as incomplete_cnt
        , round( 1- complete_cnt / start_cnt, 3) as complete_rate
    from data_f_use
    where start_cnt > complete_cnt

全部评论

相关推荐

05-24 14:12
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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