内连接 部门表里没有该员工则说明他还没有分配部门,并不需要做额外判断。有些解答做非空判断,看仔细点就会发现部门表里的部门id是非空的。直接使用内连接即可。内连接的特点是显示两个表里同时满足条件的部分,也就是交集。 select e.last_name,e.first_name,d.dept_no from employees as e inner join dept_emp as d on e.emp_no=d.emp_no