假設我們有如下表在甲骨文的SQL連接通過
create table Employee(
2 EMPNO NUMBER(3),
3 ENAME VARCHAR2(15 BYTE),
4 HIREDATE DATE,
5 ORIG_SALARY NUMBER(6),
6 CURR_SALARY NUMBER(6),
7 REGION VARCHAR2(1 BYTE),
8 MANAGER_ID NUMBER(3)
9 )
和
create table job (
2 EMPNO NUMBER(3),
3 jobtitle VARCHAR2(20 BYTE)
4 )
5/
我很感興趣,下面的查詢會
SELECT empno, manager_id, ename
2 FROM employee
3 START WITH empno = 1
4 CONNECT BY PRIOR empno = manager_id;
什麼我的理解這個代碼從僱員中選擇empno
,manager_id
,ename
,它開始選擇f ROM此行其中empno=1
,但不明白這行做:
CONNECT BY PRIOR empno = manager_id;
這是一樣的:
where empno=manager_id?
[文件](http://docs.oracle.com/cd/B19306_01/server.102/b14200/queries003.htm) – turbanoff