with ranked as( select id, job, score, row_number() over(partition by job order by score desc) t_rank, count(*) over (partition by job) cnts from grade) ( select id,job,score,t_rank from ranked where t_rank = CEIL(cnts/2) and cnts%2!=0 ) union all ( select id,job,score,t_rank from ranked where cnts%...