select id,job,score,t_rank
from (select ,row_number()over(partition by job order by score desc) t_rank,
count()over(partition by job) n
from grade) a
where t_rank >= n/2 and t_rank <= (n/2+1)
order by id;
select id,job,score,t_rank
from (select ,row_number()over(partition by job order by score desc) t_rank,
count()over(partition by job) n
from grade) a
where t_rank >= n/2 and t_rank <= (n/2+1)
order by id;