ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle各种连接

oracle各种连接

原创 Linux操作系统 作者:counghy 时间:2012-09-18 14:49:30 0 删除 编辑
内连接:
inner join 只连接2个表都有的数据
select  tab1 inner join tab2 on tab1.a=tab2.b
等价于
select a,b from tab1,tab2 where tab1.a=tab2.b
 
外连接 有三种:
left  (outer) join 左表全部数据,匹配右表,不能匹配的为空
select  tab1 left (outer) join tab2 on tab1.a=tab2.b
等价于,(+)标示匹配表
select a,b from tab1,tab2 where tab1.a=tab2.b(+)
 
right (outer) join 右表全部数据,匹配左表,不能匹配的为空
select  tab1 right(outer) join tab2 on tab1.a=tab2.b
等价于,(+)标示匹配表
select a,b from tab1,tab2 where tab1.a(+)=tab2.b
 
full (outer) join 右表全部数据,匹配左表全部数据,不能匹配的为空
select * from tab1 full join tab2 on tab1.a=tab2.b
 
总结:一般用得较多的是inner join和left join。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26249944/viewspace-743906/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2012-08-06

  • 博文量
    3
  • 访问量
    1738