题解 | 未完成试卷数大于1的有效用户

未完成试卷数大于1的有效用户

https://www.nowcoder.com/practice/46cb7a33f7204f3ba7f6536d2fc04286


select 
    uid,
    max(score_null_count) as incomplete_cnt,
    max(score_notnull_count) as complete_cnt,
    group_concat(distinct 
    concat(date_format(start_time,'%Y-%m-%d'),':',tag) 
    order by start_time separator';') as detail
from
(
    SELECT 
        uid,
        examination_info.exam_id,
        start_time,
        tag,
        sum(if(submit_time IS NULL,1,0)) over(partition by uid) as score_null_count,
        sum(if(submit_time IS NULL,0,1)) over(partition by uid) as score_notnull_count
    FROM exam_record 
    inner join examination_info
    on exam_record.exam_id = examination_info.exam_id
    WHERE YEAR(start_time)=2021
)as contain_score_nullinfo_t_1
where score_null_count<5 and score_notnull_count>=1 and score_null_count>1
group by contain_score_nullinfo_t_1.uid
order by incomplete_cnt desc


全部评论

相关推荐

2025-12-14 17:54
北京邮电大学 Java
玉字翎:我跟你情况差不多,我选择大三开始每天图书馆待七八个小时,完全不上课,九十月搞完java基础技术栈,十一月投了一整个月简历找到第一份实习,边实习边继续学
你开始找寒假实习了吗?
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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