SELECT *
FROM emp
WHERE sal > (SELECT avg(sal)
FROM emp)
SELECT c1, c2, c3
FROM SUBQUERY_T2 t2
WHERE c2 = 'A'
AND EXISTS (SELECT /*+ NO_UNNEST */ 'X'
FROM SUBQYER_T1 tw
WHERE t1.c5 = t2.c2)
SELECT /*+ QB_NQME(B)*/col1
FROM (SELECT LEVEL col1
FROM DUAL CONNECT BY LEVEL<=3) a
WHERE a.col1 IN (SELECT /*+ QB_NAME(A) */col1
FROM (SELECT LEVEL col1
FROM DUAL CONNECT BY LEVEL <=3
UNION ALL
SELECT LEVEL col1
FROM DUAL CONNECT BY LEVEL <=3
UNION ALL
SELECT LEVEL col1
FROM DUAL CONNECT BY LEVEL <=3 ) )
---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 26 | 9 (12)| 00:00:01 |
|* 1 | HASH JOIN SEMI | | 1 | 26 | 9 (12)| 00:00:01 |
| 2 | VIEW | | 1 | 13 | 2 (0)| 00:00:01 |
|* 3 | CONNECT BY WITHOUT FILTERING | | | | | |
| 4 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 5 | VIEW | VW_NSO_1 | 3 | 39 | 6 (0)| 00:00:01 |
| 6 | VIEW | | 3 | 39 | 6 (0)| 00:00:01 |
| 7 | UNION-ALL | | | | | |
|* 8 | CONNECT BY WITHOUT FILTERING| | | | | |
| 9 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
|* 10 | CONNECT BY WITHOUT FILTERING| | | | | |
| 11 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
|* 12 | CONNECT BY WITHOUT FILTERING| | | | | |
| 13 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
---------------------------------------------------------------------------------------------
COL1 |
---|
1 |
2 |
3 |
1 |
2 |
3 |
1 |
2 |
3 |
COL1 |
---|
1 |
2 |
3 |
SELECT /*+ ORDERED QB_NQME(B)*/col1
FROM (SELECT LEVEL col1
FROM DUAL CONNECT BY LEVEL<=3) a
WHERE a.col1 IN (SELECT /*+ QB_NAME(A) */col1
FROM (SELECT LEVEL col1
FROM DUAL CONNECT BY LEVEL <=3
UNION ALL
SELECT LEVEL col1
FROM DUAL CONNECT BY LEVEL <=3
UNION ALL
SELECT LEVEL col1
FROM DUAL CONNECT BY LEVEL <=3 ) ) ;
----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 26 | 10 (20)| 00:00:01 |
|* 1 | HASH JOIN | | 1 | 26 | 10 (20)| 00:00:01 |
| 2 | VIEW | VW_NSO_1 | 3 | 39 | 6 (0)| 00:00:01 |
| 3 | HASH UNIQUE | | 1 | 39 | | |
| 4 | VIEW | | 3 | 39 | 6 (0)| 00:00:01 |
| 5 | UNION-ALL | | | | | |
|* 6 | CONNECT BY WITHOUT FILTERING| | | | | |
| 7 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
|* 8 | CONNECT BY WITHOUT FILTERING| | | | | |
| 9 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
|* 10 | CONNECT BY WITHOUT FILTERING| | | | | |
| 11 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 12 | VIEW | | 1 | 13 | 2 (0)| 00:00:01 |
|* 13 | CONNECT BY WITHOUT FILTERING | | | | | |
| 14 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
----------------------------------------------------------------------------------------------
- 강좌 URL : http://www.gurubee.net/lecture/3780
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.