select dept.*,emp.* from dept left join emp on dept.deptno=emp.deptno;

应该把 dept表 放在 emp表 的左侧,这样没有员工的部门也可以查询出来,只是对应的 emp表的所有值为 null。

运行结果:
列出部门名称和这些部门的员工信息,同时列出那些没有员工的部门。

相关文章:

  • 2021-04-18
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2022-01-02
  • 2022-12-23
  • 2021-12-08
  • 2021-10-21
相关资源
相似解决方案