SELECT d.dept_no ,d.dept_name, count(s.salary) AS sum
FROM salaries s
JOIN dept_emp de
USING (emp_no)
JOIN departments d
USING (dept_no)
GROUP BY d.dept_no
ORDER BY d.dept_no
SELECT d.dept_no ,d.dept_name, count(s.salary) AS sum
FROM salaries s
JOIN dept_emp de
USING (emp_no)
JOIN departments d
USING (dept_no)
GROUP BY d.dept_no
ORDER BY d.dept_no