题解 | #各用户等级的不同得分表现占比#

各用户等级的不同得分表现占比

http://www.nowcoder.com/practice/ebff819fd38c46db8a42dfe43ca7b33a

select level,score_grade,round(count(1)/level_cn,3) as ratio
from (
    select level,score_grade,count(1)over(partition by level) as level_cn
    from (
        select level,
               case when score >= 90 then '优' 
                    when score >= 75 and score < 90 then '良'
                    when score >= 60 and score < 75 then '中'
                    else '差' end as score_grade
        from user_info t1
        join exam_record t2 on t1.uid = t2.uid
        where score is not null
        ) t
    ) t3
group by level,score_grade,level_cn
order by level desc,ratio desc

全部评论

相关推荐

脑袋锈住了:你这算啥,哥们中科院中强所硕士,本科211,叫我去干分拣,时薪20
点赞 评论 收藏
分享
程序员花海:实习和校招简历正确格式应该是教育背景+实习+项目经历+个人评价 其中项目经历注意要体现业务 实习经历里面的业务更是要自圆其说 简历模板尽可能保持干净整洁 不要太花哨的
秋招吐槽大会
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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