合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
## 5、取得平均薪水最高的部门的部门编号 ![](https://img.kancloud.cn/01/fd/01fdaf11ff3e43e4055758c5e6c7bca4_206x102.png) 思路 1.获取部门的平均工资 select deptno ,avg(sal) from emp group by deptno 2.在步骤1的基础上添加排序 降序排列 select deptno ,avg(sal) from emp group by deptno order by avg(sal) desc 3. 在步骤2的基础上获取第一条记录 select deptno ,avg(sal) from emp group by deptno order by avg(sal) desc limit 0,1