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

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

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

# 每个成绩都有等级:case when[90,75,60]分为优良中差
# 根据每个人分组,sum(case when)


select level,score_grade,
round(count(score)/max(total_cnt),3) as ratio
from
(
    select ui.uid,level,score,
    (case when score between 90 and 100 then '优' when score between 75 and 89 then '良' when score between 60 and 74 then '中' else '差' end) as score_grade,
    count(score)over(partition by level) as total_cnt
    from exam_record er join user_info ui using(uid)
    where score is not null
)a
group by level,score_grade
order by level desc,ratio desc

全部评论

相关推荐

牛客46693249...:刷kpi的,海康这个岗位已经有实习生转正了
如何判断面试是否凉了
点赞 评论 收藏
分享
09-29 16:59
已编辑
门头沟学院 Java
牛客96609213...:疯狂背刺,之前还明确设置截止日期,还有笔试,现在一帮人卡在复筛,他反而一边开启扩招,还给扩招的免笔试,真服了,你好歹先把复筛中的给处理了再说
投递大疆等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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