先分组聚合函数求出各job的分数个数num, 再逻辑函数判断出num为奇或为偶,连接各自计算公式
select job,
case when mod(num,2)=1 then round((num+1)/2) else round(num/2) end as start,
case when mod(num,2)=0 then round(num/2+1) else round((num+1)/2) end as end
from (select job,count(id) num from grade group by job) t
order by job;