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

考试分数(五)

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

select id,
       job,
       score,
       rk as t_rank
from(
    select id,
           job,
           score,
           dense_rank()over(partition by job order by score desc) as rk,##在job中的排名
           row_number()over(partition by job order by score) as rn, ##当前job的自然序号
           round((count(1)over(partition by job))/2,0) as start, ## 中位数开始位置
           round((count(1)over(partition by job)+1)/2,0) as end ##中位数结束位置
    from grade
)a
where (rn=start or rn=end) ##取中位数位置上的结果
order by id 

全部评论

相关推荐

10-31 13:04
南华大学 Java
嵌入式的小白:很多面试,面试前不会去打扰cto的,但一般cto不会在这些小事上刷人,只能说这个cto比较操心,啥重要不重要,紧急不紧急的,估计都会过问,平淡看待吧
点赞 评论 收藏
分享
09-29 15:34
已编辑
北京航空航天大学 C++
做个有文化的流氓:结果是好的,过程不重要,而且你的offer太多了
软开人,秋招你打算投哪些...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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