连表查询 select d.dept_no,d.dept_name,count(s.salary) from departments d left join (select ss.salary, de.dept_no from dept_emp de join salaries ss on de.emp_no=ss.emp_no ) s on d.dept_no=s.dept_no group by d.dept_no order by d.dept_no