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

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

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
;

全部评论

相关推荐

包行:平时怎么刷算法题的哇,字节的手撕听说都很难
字节跳动工作体验
点赞 评论 收藏
分享
11-03 14:57
西北大学 营销
Belltrix:其实就是每根转动一定的角度
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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