select d.dept_no,d.dept_name,count(s.salary) sum from departments d left join
dept_emp de on d.dept_no=de.dept_no
left join salaries s on de.emp_no = s.emp_no
group by d.dept_no order by dept_no asc
或
select d.dept_no,d.dept_name,count(s.salary) sum from (departments d left join dept_emp de on
d.dept_no =de.dept_no) left join
salaries s on de.emp_no = s.emp_no
group by d.dept_no