方法)要求连结employees表的全部行
- 包括暂时没有分配部门的员工
SELECT e.last_name, e.first_name, d.dept_name FROM departments AS d JOIN dept_emp AS de ON d.dept_no = de.dept_no RIGHT JOIN employees AS e ON de.emp_no = e.emp_no;
SELECT e.last_name, e.first_name, d.dept_name FROM departments AS d JOIN dept_emp AS de ON d.dept_no = de.dept_no RIGHT JOIN employees AS e ON de.emp_no = e.emp_no;