SQL275热题
查询每个岗位中位数位置上所有grade的信息
代码如下:
select id, job, score, t_rank from
(
select *,
(dense_rank()over(partition by job order by score desc))t_rank,
count(*)over(partition by job)N from grade
)t
where t_rank >= N/2 and t_rank <= N/2 + 1
order by id ASC
#笔试#