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

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

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

with t as 
(select t.uid,exam_id,score,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,
       count(exam_id)over(partition by level) as total
from user_info t 
join exam_record t1 using(uid)
where score is not NULL)
select level,score_grade,round(count(level)/total,3) as ratio
from t
group by level,score_grade
order by level desc,ratio desc
全部评论

相关推荐

真烦好烦真烦:豆包润色了自己没看看吗,再说了,都说豆包是愚蠢且勤快的大学生,ds才是聪明的研究生,怎么敢让豆包写论文的
你们的毕业论文什么进度了
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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