* Node 자르기: WHERE 절
select level, lpad(empno, level*4, ' ') as empno, ename, job, mgr, sal
from emp e
where empno <> 7698
start with empno = 7839
connect by prior empno = mgr;
* Branch 자르기: CONNECT BY 절
select level, lpad(empno, level*4, ' ') as empno, ename, job, mgr, sal
from emp e
start with empno = 7839
connect by prior empno = mgr and empno <> 7698;
'Oracle > SQL Fundamentals II' 카테고리의 다른 글
15일차 # sys_connect_by_path 함수 (0) | 2012.04.24 |
---|---|
15일차 # 정렬: Order siblings by (0) | 2012.04.24 |
15일차 # 7-11: 결과를 보기 좋게 만들기 (0) | 2012.04.24 |
15일차 # 7-10: Level, a Hierarchical Query Pseudocolumn (0) | 2012.04.24 |
15일차 # 7-7: Top-Down vs. Bottom-Up (0) | 2012.04.24 |