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

考试分数(五)

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

select
    id,
    job,
    score,
    t_rank
from (
    select
        id,
        job,
        score,
        count(score) over (partition by job) as total,
        row_number() over(partition by job order by score desc) as t_rank
    from grade
) as g1
where 
(
    case when total % 2 = 0 then t_rank = total/2 or t_rank = total/2 + 1
    else t_rank = CEILING(total/2)
    end )
order by id

全部评论

相关推荐

06-23 11:43
门头沟学院 Java
allin校招的烤冷...:我靠,今天中午我也是这个hr隔一个星期发消息给我。问的问题还是一模一样的😅
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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