oracle中各类链接事例,left join、right join、full join

Aspa

  

B3d

 

--内链接 把匹配的信息所有查出来
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;
 
相关文章
相关标签/搜索