Oracle/SQL Fundamentals II
14일차 # 6-3: Pairwise vs. Nonpairwise (컬럼 비교)
Bohemian life
2012. 4. 23. 22:45
drop table t1 purge;
drop table t2 purge;
create table t1 (no number, name varchar2(10));
insert into t1 values (10, 'AAA');
insert into t1 values (10, 'BBB');
insert into t1 values (20, 'AAA');
insert into t1 values (20, 'BBB');
commit;
create table t2 (no number, name varchar2(10));
insert into t2 values (10, 'AAA');
insert into t2 values (20, 'BBB');
commit;
- nonpairwise
select * from t1
where no in (select no from t2) -- 10, 20
and name in (select name from t2); -- AAA, BBB
- pairwise
select * from t1
where (no, name) in (select no, name -- (10, AAA), (20, BBB)
from t2);