- 查询所有从事CLERK工作的雇员姓名及其部门名称、部门人数。
SQL查询语句:
SELECT e.ename AS employee_name, d.dname AS department_name, COUNT(e.empno) AS department_count
FROM emp e
JOIN dept d ON e.deptno = d.deptno
WHERE e.job = 'CLERK'
GROUP BY d.dname, e.ename;
SQL查询语句:
SELECT e.ename AS employee_name, d.dname AS department_name, COUNT(e.empno) AS department_count
FROM emp e
JOIN dept d ON e.deptno = d.deptno
WHERE e.job = 'CLERK'
GROUP BY d.dname, e.ename;