题解 | 考试分数(五)

考试分数(五)

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

with p as (
    select id,job,score,row_number() over(partition by job order by score desc) as t_rank,
    count(*) over (partition by job) as total
    from grade
)


select id,job,score,t_rank
from p
where t_rank between total/2 and total/2+1
order by id

注意这里的select 了t_rank 而不是avg(t_rank)

全部评论

相关推荐

仁者伍敌:难怪小公司那么挑剔,让你们这些大佬把位置拿了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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