title: Connect by in Oracle SQL
body: <p>Suppose that we have following tables</p>
  
  <pre><code>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  )
  </code></pre>
  
  <p>and    </p>
  
  <pre><code>create table job (
    2    EMPNO         NUMBER(3),
    3    jobtitle      VARCHAR2(20 BYTE)
    4  )
    5  /
  </code></pre>
  
  <p>I am interested in what the below query does</p>
  
  <pre><code>SELECT empno, manager_id, ename
    2  FROM employee
    3  START WITH empno = 1
    4  CONNECT BY PRIOR empno = manager_id;
  </code></pre>
  
  <p>As I understood this code selects <code>empno</code>,<code>manager_id</code>,<code>ename</code> from employee, it starts selection from this row where <code>empno=1</code>, but could not understand what this line does: </p>
  
  <pre><code>CONNECT BY PRIOR empno = manager_id;
  </code></pre>
  
  <p>Is this the same as: </p>
  
  <pre><code>where empno=manager_id?
  </code></pre>