oracle数据库连接类型

连接类型
1.cross join 笛卡尔积
不能带条件,如on子句

2.inner join 内连接
默认的连接,inner可省略

3.outer join 外连接
FROM table1 { LEFT | RIGHT | FULL } [OUTER] JOIN table2
left:返回table1中的所有记录,table2对应列显示空
right:返回table2中的所有记录,table1对应列显示空
full: 不匹配的记录全部显示

outer :默认可缺省,oracle会自动在left,right,full后增加outer

left outer join
select d.dept_id,d.name,l.regional_group
from department d left outer join location l
on d.location_id=l.location_id
早期的写法
select d.dept_id,d.name,l.regional_group
from department d,location l
where d.location_id=l.location_id(+)
返回department表里所有记录


right outer join
select d.dept_id,d.name,l.regional_group
from department d right outer join location l
on d.location_id=l.location_id
早期的写法
select d.dept_id,d.name,l.regional_group
from department d,location l
where d.location_id(+)=l.location_id
返回location表里所有记录

full outer join
两张表不匹配的记录都显示
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值