select *
from emp
where deptno in (select /*+ no_unnest */ deptno from dept)
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 5 | 185 | 3 (0)| 00:00:01 |
|* 1 | FILTER | | | | | |
| 2 | TABLE ACCESS FULL| EMP | 14 | 518 | 3 (0)| 00:00:01 |
|* 3 | INDEX UNIQUE SCAN| PK_DEPT | 1 | 3 | 0 (0)| 00:00:01 |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter( EXISTS (SELECT /*+ NO_UNNEST */ 0 FROM "DEPT"
"DEPT" WHERE "DEPTNO"=:B1))
3 - access("DEPTNO"=:B1)
select *
from (select deptno from dept) a, emp b
where b.deptno = a.deptno
select emp.*
from dept, emp
where emp.deptno = dept.deptno
select *
from emp
where deptno in (select /*+ unnest */ deptno from dept)
----------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 10 | 350 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| EMP | 3 | 99 | 1 (0)| 00:00:01 |
| 2 | NESTED LOOPS | | 10 | 350 | 2 (0)| 00:00:01 |
| 3 | INDEX FULL SCAN | DEPT_PK | 4 | 8 | 1 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | EMP_DEPTNO_IDX | 3 | | 0 (0)| 00:00:01 |
----------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
4 - access("DEPTNO"="DEPTNO")
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 14 | 560 | 3 (0)| 00:00:01 |
| 1 | NESTED LOOPS | | 14 | 560 | 3 (0)| 00:00:01 |
| 2 | TABLE ACCESS FULL| EMP | 14 | 518 | 3 (0)| 00:00:01 |
|* 3 | INDEX UNIQUE SCAN| PK_DEPT | 1 | 3 | 0 (0)| 00:00:01 |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - access("DEPTNO"="DEPTNO")
select /*+ leading(emp) */ *
from emp
where deptno in (select /*+ unnest */ deptno from dept)
select /*+ leading(dept) */ *
from emp
where deptno in (select /*+ unnest */ deptno from dept)
select /*+ ordered */ *
from emp
where deptno in (select /*+ unnest */ deptno from dept)
select /*+ leading(dept@qb1) */ *
from emp
where deptno in (select /*+ unnest qb_name(qb1) */ deptno from dept)
<사례1>
select *
from dept
where deptno in (select deptno from emp)
select *
from (select deptno from emp) a, dept b
where b.deptno = a.deptno
<사례2>
select *
from emp
where deptno in (select deptno from dept)