题解 | #考试分数(五)#
考试分数(五)
https://www.nowcoder.com/practice/b626ff9e2ad04789954c2132c74c0513
with a as( select id,job,score, row_number() over(partition by job order by score desc) as t_rank, count(id) over(partition by job) as num from grade ) select id,job,score,t_rank from a where abs(t_rank-(num+1)/2) < 1 order by id,t_rank
中位数的位置距离(总数+1)/2的位置小于1