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

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

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

with t1 as (
     select er.uid,level,score,
(case when score<60 then '差'
      when score>=60 and score<75 then '中'
      when score>=75 and score<90 then '良'
      else '优'
      end) as grade
from exam_record er left join user_info ui on er.uid=ui.uid
where score is not null
)
select distinct level,grade score_grade,
round(
count(score)over(partition by level,grade)/count(score)over(partition by level),3
) ratio
from t1
order by level desc,ratio desc
;

全部评论

相关推荐

安静的鲸鱼offer...:神仙级别hr,可遇不可求,甚至他可能也是突然有感而发。只能说遇上是件幸事。
秋招开始捡漏了吗
点赞 评论 收藏
分享
青春运维少年不会梦到...:实习大王
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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