题解 | #考试分数(五)#

考试分数(五)

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

select t.id,t.job,t.score,t.t_rank 
 from  
    (select *,
        DENSE_RANK() over (partition by job order by score DESC) as t_rank,
        COUNT(job) over (partition by job) as num
    from grade) t
where t.t_rank = FLOOR((t.num + 1)/2) or t.t_rank = CEIL((t.num + 1)/2)
order by t.id

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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