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

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

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

with t as
(select level,score,count(level)over(partition by level) as level_cn,
(case when score<60 then '差'
when score<75 and score>=60 then '中'
when score<90 and score>=75 then '良'
else '优' end) as grade
from exam_record
left join user_info
using(uid)
where score is not null)


select level,grade,round(count(level)/level_cn,3) as ratio
from t
group by level,grade
order by level desc,ratio desc

全部评论

相关推荐

牛客21331815...:像我一投就pass,根本不用焦虑泡池子
点赞 评论 收藏
分享
勇敢的90后想交流:我愿意付费上班,楼主你就安心字节待着吧,我是真的喜欢上班
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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