[code] drop table a; drop table b; create table a(type_id int,type_name varchar2(10)); insert into a values(1,'test01'); insert into a values(2,'test02'); insert into a values(3,'test03'); insert into a values(4,'test04'); insert into a values(5,'test05');create table b(id int,description varchar2(10)); insert into b values(1,'ok'); insert into b values(2,'error'); insert into b values(3,'hello');commit;select * from a left join b on a.type_id=b.id SQL> connect test01/test01; 已连接。 SQL> select * from a 2 left join b on a.type_id=b.id; TYPE_ID TYPE_NAME ID DESCRIPTIO ---------- ---------- ---------- ---------- 1 test01 1 ok 2 test02 2 error 3 test03 3 hello 5 test05 4 test04 [/code]
drop table a; drop table b; create table a(type_id int,type_name varchar2(10)); insert into a values(1,'test01'); insert into a values(2,'test02'); insert into a values(3,'test03'); insert into a values(4,'test04'); insert into a values(5,'test05');create table b(id int,description varchar2(10)); insert into b values(1,'ok'); insert into b values(2,'error'); insert into b values(3,'hello');commit;SQL> connect test01/test01; 已连接。 SQL> select * from a 2 left join b on a.type_id=b.id; TYPE_ID TYPE_NAME ID DESCRIPTIO ---------- ---------- ---------- ---------- 1 test01 1 ok 2 test02 2 error 3 test03 3 hello 5 test05 4 test04
select * from a,b
where a.type_id(+)=b.id
where a.type_id = b.id(+)
from a
left join b
on a.type_id=b.id
from a,b
where
a.type_id=b.id(+)
drop table a;
drop table b;
create table a(type_id int,type_name varchar2(10));
insert into a values(1,'test01');
insert into a values(2,'test02');
insert into a values(3,'test03');
insert into a values(4,'test04');
insert into a values(5,'test05');create table b(id int,description varchar2(10));
insert into b values(1,'ok');
insert into b values(2,'error');
insert into b values(3,'hello');commit;select * from a
left join b on a.type_id=b.id
SQL> connect test01/test01;
已连接。
SQL> select * from a
2 left join b on a.type_id=b.id; TYPE_ID TYPE_NAME ID DESCRIPTIO
---------- ---------- ---------- ----------
1 test01 1 ok
2 test02 2 error
3 test03 3 hello
5 test05
4 test04
[/code]
drop table b;
create table a(type_id int,type_name varchar2(10));
insert into a values(1,'test01');
insert into a values(2,'test02');
insert into a values(3,'test03');
insert into a values(4,'test04');
insert into a values(5,'test05');create table b(id int,description varchar2(10));
insert into b values(1,'ok');
insert into b values(2,'error');
insert into b values(3,'hello');commit;SQL> connect test01/test01;
已连接。
SQL> select * from a
2 left join b on a.type_id=b.id; TYPE_ID TYPE_NAME ID DESCRIPTIO
---------- ---------- ---------- ----------
1 test01 1 ok
2 test02 2 error
3 test03 3 hello
5 test05
4 test04