外连接与内连接

1.左外连接
select * from t_a a left join t_b b on a.id=b.id;
select * from t_a a,t_b b where a.id=b.id(+);

2.右外连接
select * from t_a a right join t_b b on a.id = b.id;
select * from t_a a,t_b b where a.id(+)=b.id;

3.完全外连接
select * from t_a a full join t_b b on a.id=b.id;

4.等值连接(我们在看看等值连接的结果)
select * from t_a a,t_b b where a.id=b.id;
select * from t_a a join t_b b on a.id=b.id;--等值连接也可以这样写

注意:以前理解等值连接和完全外连接是一回事,现在看来是我理解错了。等值连接是只把满足条件的两个表的行相连,然后显示出来。完全外连接是把匹配查询条件的行、左表没有匹配到的、右表没有匹配到的都显示出来。

原文地址:https://www.cnblogs.com/sjxbg/p/10482806.html