select max(sal) from emp group by deptno
#把deptno分为**组,每组找到薪资最高的数据
select 语句进行数据分析
select max(sal) from emp group by depto ,job
#depto,job都相同的认定为一组
使用子查询,解决无法匹配的问题
select ename from emp where sat=(select max(sal) from emp)
使用的表链接
先取出一张表-----中间表
#求每个部门薪水薪水最高人的名
select ename,sal,emp.deptno from emp join
(select deptno,max(sal) max_sal from emp group by deptno) t
where emp.deptno=t.deptno and emp.sal=t.max_sal