with t as (
select id, company, salary, row_number() over(partition by company order by salary) as 'rk', count(id) over(partition by company) as 'cnt'
from Employee
)
select id, company, salary
from t
where rk >= cnt / 2 and rk <= cnt / 2 + 1
不算难吧,如果用函数的话,很有意思的事,中位数这个问题通过cnt和rank的大小来决定是一个还是两个,这个点想到了应该没什么难度