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

考试分数(五)

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

select g.id, g.job, g.score, g.r
from
(
select id, job, score, rank() over(partition by job order by score desc) r from grade 
) g
join 
(
select job, 
    round(case when count(job)%2=1 then (1+count(job))/2 else count(job)/2 end) start,
    round(case when count(job)%2=1 then (1+count(job))/2 else count(job)/2+1 end) end
from 
(
select id, job, score, rank() over(partition by job order by score desc) r from grade 
)t
group by job
)t1
on g.job = t1.job
where g.r >= t1.start and g.r <= t1.end
order by g.id

全部评论

相关推荐

04-17 10:16
门头沟学院 Java
小浪_coder:24届很难找了,马上25的都毕业了还有很多没找到的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务