有这样两个表:

一、

sql语句:
select * from tbl_dept a inner join tbl_emp b on a.id = b.depId;
二、

sql语句:
select * from tbl_dept a left join tbl_emp b on a.id=b.deptId;
三、

sql语句
select * from tbl_dept a right join tbl_emp b on a.id = b.deptId;
四、

sql语句:
select * from tbl_dept a left join tbl_emp b on a.id=b.deptId where b.deptId is null;
五、

sql语句
select * from tbl_dept a right join tbl_emp b on a.id=b.deptId where a.id is null;
六、

sql语句
select * from tbl_dept a right join tbl_emp b on a.id=b.deptId
union
select * from tbl_dept a left join tbl_emp b on a.id=b.deptId;
七、

sql语句
select * from tbl_dept a right join tbl_emp b on a.id=b.depId where a.id is null
union
select * from tbl_dept a left join tbl_emp b on a.id=b.depId where b.deptId is null;

2138

被折叠的 条评论
为什么被折叠?



