MYSQL:
select d.dept_no,d.dept_name,count(salary) as sum from departments d join dept_emp de on d.dept_no=de.dept_no join salaries s on de.emp_no=s.emp_no group by d.dept_no order by dept_no;