oracle中各种连接事例,left join、right join、full join

A

  

B

 

--内连接 把匹配的信息全部查出来
select * from t_wdx_a a inner join t_wdx_b b on a.id = b.id; 

--左连接 包含左边表所有记录,右边所有的匹配的记录,如果没有则用空补齐(简写的时候+在右边)
select * from t_wdx_a a left join t_wdx_b b on a.id = b.id;
select * from t_wdx_a a left outer join t_wdx_b b on a.id = b.id;
select * from t_wdx_a a,t_wdx_b b where a.id = b.id(+);
--right join 右连接 包括右边表所有记录,匹配左边表的记录,如果没有则以空补齐(简写的时候+在左边)
select * from t_wdx_a a right join t_wdx_b b on a.id = b.id;
select * from t_wdx_a a, t_wdx_b b where a.id(+) = b.id;
--full join  全连接 意思是左右表所有的记录全部显示出来
select * from t_wdx_a a full join t_wdx_b b on a.id = b.id;
 

原文地址:https://www.cnblogs.com/yeyerl/p/7682081.html