查询没有员工的部门 使用 count0实现
可以使用以下SQL语句查询没有员工的部门:
SELECT department_id, COUNT(0) AS employee_count FROM departments LEFT JOIN employees ON departments.department_id = employees.department_id GROUP BY department_id HAVING employee_count = 0;
原文地址: https://www.cveoy.top/t/topic/iExv 著作权归作者所有。请勿转载和采集!