with d as (
    select id,job,score, dense_rank () over(partition by job order by score) rk,
    count(*) over(partition by job) total from grade
)

select d.job, round(d.total/2,0) as start,
(case when d.total%2 !=0 
then round(d.total/2,0) 
else round(d.total/2+1,0) end)as end

from d
group by d.job
order by d.job







学习from https://www.bilibili.com/video/BV12X4y1o7TW/?spm_id_from=333.337.search-card.all.click&vd_source=01bee36d06fa0efc4887211e7d7c2dbd