• 2022-06-29
    列出所有部门的部门名称和部门员工人数。如果部门没有员工,人数显示为0。正确的查询语句有_________。
    A: SELECT dname,COUNT(ename) AS ecount
    FROM dept,emp
    WHERE emp.deptno(+)=dept.deptno
    GROUP BY dept.dname
    B: SELECT dname,(SELECT COUNT(*) AS ecount FROM emp WHERE emp.deptno=dept.deptno)
    FROM dept
    C: SELECT dname,COUNT(ename) AS ecount
    FROM dept LEFT JOIN emp ON emp.deptno=dept.deptno
    GROUP BY dept.dname
    D: SELECT dname,COUNT(*) AS ecount
    FROM dept LEFT JOIN emp ON emp.deptno=dept.deptno
    GROUP BY dept.dname