tb1:
id content
1 abc
2 bcd
3 cdetb2:
id content
2 xyz
3 wxy
4 vwx建两张如上的表 把你的问题做一下,看看结果你就知道答案了select tb1.*,tb2.* from tb1,tb2 where tb1.id=tb2.id
select tb1.*,tb2.* from tb1,tb2 where tb1.id(+)=tb2.id
select tb1.*,tb2.* from tb1,tb2 where tb1.id=tb2.id(+)
id content
1 abc
2 bcd
3 cdetb2:
id content
2 xyz
3 wxy
4 vwx建两张如上的表 把你的问题做一下,看看结果你就知道答案了select tb1.*,tb2.* from tb1,tb2 where tb1.id=tb2.id
select tb1.*,tb2.* from tb1,tb2 where tb1.id(+)=tb2.id
select tb1.*,tb2.* from tb1,tb2 where tb1.id=tb2.id(+)
ORACLE好象是有left out join和rigth out join的语法吧???
SQL> create table tb1(
2 id number,
3 content varchar2(30));表已创建。SQL> create table tb2(
2 id number,
3 content varchar2(30));表已创建。SQL> select tb1.*,tb2.* from tb1,tb2 where tb1.id=tb2.id; ID CONTENT ID CONTENT
---------- ------------------------------ ---------- ----------------
1 ad 1
2 asdf 2
3 ad 3
4 4 adfSQL> select * from tb1,tb2 where tb1.id(+)=tb2.id; ID CONTENT ID CONTENT
---------- ------------------------------ ---------- ----------------
1 ad 1
2 asdf 2
3 ad 3
4 4 adf
5 lksjdSQL> select * from tb1,tb2 where tb1.id=tb2.id(+); ID CONTENT ID CONTENT
---------- ------------------------------ ---------- ----------------
1 ad 1
2 asdf 2
3 ad 3
4 4 adf
6 390456SQL> select * from tb1
2 union
3 select * from tb2; ID CONTENT
---------- ------------------------------
1 ad
1
2 asdf
2
3 ad
3
4 adf
4
5 lksjd
6 390456已选择10行。SQL>
UNION ALL 两个表的全部集合 不会过滤
效率及差.
(+)的意思就是:没有也要选出来的意思.
例如:
a.test=b.test(+)
就是说: a中所有的记录都要选出来,b有就出,没有就没有