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

考试分数(五)

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

全部评论

相关推荐

10-17 12:16
同济大学 Java
7182oat:快快放弃了然后发给我,然后让我也泡他七天最后再拒掉,狠狠羞辱他一把😋
点赞 评论 收藏
分享
10-15 16:27
门头沟学院 C++
LeoMoon:建议问一下是不是你给他付钱😅😅
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务