drop table aa;
drop table bb;
create table aa (aid number(3),aname varchar2(5));
create table bb (bid number(3),bdept varchar2(5));
alter table bb rename column bid to aid;
select * from aa for update;
select * from bb for update;
1.左连接
select * from aa a left join bb b where a.aid = b.aid;左连接
select * from aa a left out join bb b where a.aid = b.aid;左连接
select * from aa a,bb b where a.aid = b.aid(+);左连接
2.右链接
select * from aa a right join bb b where a.aid = b.aid;右链接
select * from aa a right out join bb b where a.aid = b.aid;右链接
select * from aa a,bb b where a.aid(+) = b.aid;右链接
3.全连接
select * from aa a full join bb b on a.aid = b.aid;全连接 使用on
select * from aa a full outer join bb b on a.aid = b.aid;全连接 使用on
4.union
(select * from aa a) union (select * from bb b),重复的屏蔽
在aa中添加1,大头,union all
(select * from aa a) union all (select * from bb b)全部显示