2013年2月5日 星期二

Join的方法比較, inner join, left join, right join, outer join








準備資料

create table test1
(
 id number(1),
 name nvarchar2(10),
 phone nvarchar2(10)
);

create table test2
(
 id number(1),
 pid nvarchar2(10),
 country nvarchar2(10)
);


insert into test1 values(1, 'Mr.Wu', '0931123xxx');
insert into test1 values(2, 'Mr.Wang', '0932123xxx');
insert into test1 values(3, 'Mr.Lin', '0933123xxx');

insert into test2 values(1, '1', 'TW');
insert into test2 values(2, '1', 'US');
insert into test2 values(3, '2', 'Kaohsiung');
insert into test2 values(4, '3', 'Taipei');

沒有留言:

張貼留言