通过两次left join来连接三张表,这样就可以保证name始终有值。
select e.last_name, e.first_name, d.dept_name
from employees as e
left join dept_emp as de
on de.emp_no = e.emp_no
left join departments as d
on de.dept_no = d.dept_no
通过两次left join来连接三张表,这样就可以保证name始终有值。
select e.last_name, e.first_name, d.dept_name
from employees as e
left join dept_emp as de
on de.emp_no = e.emp_no
left join departments as d
on de.dept_no = d.dept_no