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);
'Oracle > SQL Fundamentals II' 카테고리의 다른 글
14일차 # 6-10: Nested Subquery vs. Correlated Subquery (0) | 2012.04.23 |
---|---|
14일차 # 6-7: Scalar Subquery (0) | 2012.04.23 |
14일차 # 5-28: Conversion functions (0) | 2012.04.23 |
14일차 # 5-26: TZ_OFFSET (0) | 2012.04.23 |
14일차 # 5-25: EXTRACT ( ... FROM ... ) (0) | 2012.04.23 |