http://192.168.10.158:5560/isqlplus/
--求部门中哪些人的薪水最高
select ename,sal from emp
join (select max(sal) max_sal,deptno from emp group by deptno) t
on (emp.sal=t.max_sal and emp.deptno=t.deptno)
--求部门平均薪水的等级
select deptno,avg_sal,grade from
(select deptno,avg(sal) avg_sal from emp group by deptno) t
join salgrade s on(t.avg_sal between s.losal and s.hisal);
--求部门平均的薪水等级
select deptno,avg(grade) from
(select deptno,ename,grade from emp join salgrade s on (emp.sal.between s.losal and s.hisal)) t group by deptno