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

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

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

全部评论

相关推荐

马上就好了:HR看了以为来卧底来了
点赞 评论 收藏
分享
钱嘛数字而已:辅导员肯定不能同意,不然你出事了,他要承担责任。但是,脚和脑子都长在你自己身上,使用它还需要向辅导员报告么? 辅导员必须按流程拒绝你,然后你拿出成年人的态度,做自己的选择。
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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