select
departments.id,
departments.department,
count(*) as count
from departments
join employees on employees.department_id = departments.id
group by departments.id, departments.name;
select
departments.id,
departments.department,
count(*) as count
from departments
left join employees on employees.department_id = departments.id
group by departments.id, departments.name;
select d.DEPARTMENT_ID, d.DEPARTMENT_NAME, COUNT(e.EMPLOYEE_ID)
from departments d
left join employees e on d.DEPARTMENT_ID = e.DEPARTMENT_ID
group by d.DEPARTMENT_ID, d.DEPARTMENT_NAME;