示例一.查询出每个部门的编号,名称,位置,部门人数,平均工资 SELECT d.deptno,d.dname,d.loc, (SELECT COUNT(empno) FROM emp WHERE emp.deptno=d.deptno GROUP BY deptno) con, (SELECT AVG(sal) FROM emp WHERE emp.deptno=d.deptno GROUP BY deptno) avgsal FROM dept d WITH 子句 示例二.使用with子句将e…