SQL查询语句的相关问题

问题遇到的现象和发生背景

查询男性工资最高的5位
查询女性工资最高的5位

问题相关代码
select top 5 peopleName,peopleSalary, peopleSex
from people where peopleSex ='男'order by peopleSalary desc
select  top 5 peopleName,peopleSalary, peopleSex
from people where peopleSex='女' order by peopleSalary desc
我想要达到的结果

合并为一条SQL语句完成分别查询男性与女性工资最高的5位员工信息

select * , row_number() over(partition by peopleSix order by peopleSalart desc) rn
from people where rn < 6

union或者union all合并查询结果。