题解 | #未完成率较高的50%用户近三个月答卷情况#

未完成率较高的50%用户近三个月答卷情况

https://www.nowcoder.com/practice/3e598a2dcd854db8b1a3c48e5904fe1c

select uid,date_format(start_time,'%Y%m') start_month,count(*) total_cnt,count(submit_time) complete_cnt from    
    (select *,dense_rank() over(partition by uid order by date_format(start_time,'%Y%m') desc) drk from exam_record) t
where drk <= 3
group by uid,date_format(start_time,'%Y%m')
having uid in
    (select uid from    
        (select uid from    
            (select *,row_number() over(order by incomplete_rate desc) rk,count(uid) over() total from    
                (select uid,1-count(submit_time)/count(*) incomplete_rate from exam_record er
                left join examination_info ei
                using(exam_id)
                where tag = 'SQL'
                group by uid) a) b
        where rk < total*0.5+1) c
    left join user_info ui
    using(uid)
    where level in (6,7))
order by uid,start_month

全部评论

相关推荐

牛客83265014...:完了,连现在都没开始面,13号投的是不是晚了
秋招的第一个offer,...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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