oracle表连接

 

create table a(
aid number,
aname varchar2(20)
);
create table b(
bid number,
bname varchar2(20)
);

create table c(
cid number,
cname varchar2(20)
);

insert into a(aid,aname)

SELECT 1,'a1' FROM dual
union all
SELECT 2,'a2' FROM dual;

insert into b
SELECT 1,'b1' FROM dual;

insert into c
SELECT 2,'c2' FROM dual
union all
SELECT 1,'c1' FROM dual;

commit;

 

1、SELECT * FROM a left join b on a.aid=b.bid left join c on c.cid= a.aid;

结果:

2、SELECT * FROM a left join b on a.aid=b.bid left join c on c.cid= b.bid;

3、SELECT * FROM a left join b on a.aid=b.bid right join c on c.cid= b.bid;

4、SELECT * FROM a inner join b on a.aid=b.bid right join c on c.cid= b.bid;

5、SELECT * FROM a inner join b on a.aid=b.bid left join c on c.cid= b.bid;

6、SELECT * FROM a cross join c

 

posted @ 2018-04-16 10:19  半入江风半入云  阅读(160)  评论(0编辑  收藏  举报