2011-08-03 10:49:08
SQL 4 Oracle 오라클용 sql 실무
▒ minus 처리1
select a.고객ID, a.고객명, a.취득일자, a.점수
from 목적_Table a,
(select c.고객ID
from 목적_Table c
where c.고객상태='활동중'
minus
select d.고객ID
from 주소_Table d) b
where a.고객상태='활동중'
and a.고객ID=b.고객ID
▒ minus 처리2
select a.고객ID, a.고객명, a.취득일자, a.점수
from 목적_Table a
where a.고객상태='활동중'
and a.고객ID in
(select c.고객ID
from 목적_Table c
where c.고객상태='활동중'
minus
select d.고객ID
from 주소_Table d )
▒ minus 처리3 not in과 같은기능 ( 전 이것을 선호 인덱스에 따라 속도는 떨어질수 있음)
select a.고객ID, a.고객명, a.취득일자, a.점수
from 목적_Table a
where a.고객상태='활동중'
and a.고객ID not in
(select b.고객ID
from 주소_Table b
where b.고객ID=a.고객ID)

'SQL4Oracle' 카테고리의 다른 글
| update 스타일 (0) | 2023.03.10 |
|---|---|
| insert 스타일 (0) | 2023.03.10 |
| like 와 substr() (0) | 2023.03.10 |
| 합계점수 구간 추출 (0) | 2023.03.10 |
| Oracle 테이블 명세서 추출 (0) | 2023.03.10 |