表部门
表员工
有一个没有任何员工的运营部门。所以,我相信查询也会检索到行(图 1):
Department_ID=10 , Department_Name =Operations, Employee=0
为什么不发生???
SELECT EMPLOYEE.Department_ID, DEPARTMENT.Department_Name, Count(*) AS Employees
FROM EMPLOYEE right JOIN DEPARTMENT ON DEPARTMENT.Department_ID = EMPLOYEE.Department_ID
GROUP BY DEPARTMENT.Department_Name,.EMPLOYEE.Department_ID