3 个表的连接
1. 一般先关联表1,表2
2. 得出关联后,再联表3
#关联1,2 SELECT d.dept_no, d.dept_name, COUNT(s.salary) AS 'sum' FROM departments AS d JOIN dept_emp AS de ON d.dept_no = de.dept_no #关联3 LEFT JOIN salaries as s ON de.emp_no = s.emp_no GROUP BY d.dept_no ORDER BY d.dept_no