题解 | #各用户等级的不同得分表现占比#
各用户等级的不同得分表现占比
https://www.nowcoder.com/practice/ebff819fd38c46db8a42dfe43ca7b33a
select level,score_grade, round(count(*)/(sum(count(*)) over(partition by level)),3) as ratio from (select user_info.uid,level,score, case when score >= 90 then '优' when score >= 75 then '良' when score >= 60 then '中' else '差' end as score_grade from user_info,exam_record where user_info.uid = exam_record.uid and score is not null) a group by level,score_grade order by level desc,ratio desc