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

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

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

with c as
(
select level,a.*,count(*) over (partition by level) sum from 
user_info right join(
select uid,score,case when score<60 then '差' when score>=60 and score<75 then '中' 
when score>=75 and score<90 then '良' when score>=90  then '优' else '差' end as score_grade
from (
select uid,exam_id,score from exam_record where submit_time is not null
)b
)a
using(uid)
)
select level,score_grade,round(count(*)/sum,3) rate from c
group by level,score_grade
order by level desc,rate desc

全部评论

相关推荐

Cherrycola01:0实习 0项目 约等于啥也没有啊 哥们儿这简历认真的吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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