取得平均薪水最高的部门的部门名称

    直接用员工表去连接部门表,然后根据部门名称进行分组

    1. select
    2. d.dname,avg(e.sal) avgsal
    3. from
    4. emp e
    5. join
    6. dept d
    7. on
    8. e.deptno=d.deptno
    9. group by
    10. d.dname
    11. order by
    12. avgsal desc
    13. limit
    14. 1