Please consider the two tables - Employee and Department
Employee.DeptID is a foreign key to Department.DepartmentID
DepartmentName Number of employees
SELECT d.deptID, count(e.deptID) FROM Department d LEFT JOIN Employee e ON d.DeptID = e.DeptID GROUP BY d.deptId
LEFT JOIN is used to include departments that do not have employees.