SELECT last_name, employee_id, manager_id
FROM hr.employees
CONNECT BY employee_id = manager_id
ORDER BY last_name
LAST_NAME | EMPLOYEE_ID | MANAGER_ID |
---|---|---|
Abel | 174 | 149 |
Ande | 166 | 147 |
Atkinson | 130 | 121 |
Austin | 105 | 103 |
Baer | 204 | 101 |
Baida | 116 | 114 |
Banda | 167 | 147 |
Bates | 172 | 148 |
Bell | 192 | 123 |
Bernstein | 151 | 145 |
Bissot | 129 | 121 |
Bloom | 169 | 148 |
Bull | 185 | 121 |
Cabrio | 187 | 121 |
Cambrault | 148 | 100 |
Cambrault | 154 | 145 |
Chen | 110 | 108 |
Chung | 188 | 122 |
Colmenares | 119 | 114 |
Davies | 142 | 124 |
De Haan | 102 | 100 |
Dellinger | 186 | 121 |
Dilly | 189 | 122 |
Doran | 160 | 146 |
Ernst | 104 | 103 |
Errazuriz | 147 | 100 |
Everett | 193 | 123 |
Faviet | 109 | 108 |
Fay | 202 | 201 |
Feeney | 197 | 124 |
Fleaur | 181 | 120 |
Fox | 170 | 148 |
Fripp | 121 | 100 |
Gates | 190 | 122 |
Gee | 135 | 122 |
Geoni | 183 | 120 |
Gietz | 206 | 205 |
Grant | 199 | 124 |
Grant | 178 | 149 |
Greenberg | 108 | 101 |
Greene | 163 | 147 |
Hall | 152 | 145 |
Hartstein | 201 | 100 |
Higgins | 205 | 101 |
Himuro | 118 | 114 |
Hunold | 103 | 102 |
Hutton | 175 | 149 |
Johnson | 179 | 149 |
Jones | 195 | 123 |
Kaufling | 122 | 100 |
Khoo | 115 | 114 |
SELECT last_name, employee_id, manager_id
FROM HR.employees
CONNECT BY PRIOR employee_id = manager_id
AND salary > commission_pct
ORDER BY last_name
LAST_NAME | EMPLOYEE_ID | MANAGER_ID |
---|---|---|
Abel | 174 | 149 |
Abel | 174 | 149 |
Abel | 174 | 149 |
Ande | 166 | 147 |
Ande | 166 | 147 |
Ande | 166 | 147 |
Atkinson | 130 | 121 |
Austin | 105 | 103 |
Baer | 204 | 101 |
Baida | 116 | 114 |
Banda | 167 | 147 |
Banda | 167 | 147 |
Banda | 167 | 147 |
Bates | 172 | 148 |
Bates | 172 | 148 |
Bates | 172 | 148 |
Bell | 192 | 123 |
Bernstein | 151 | 145 |
Bernstein | 151 | 145 |
Bernstein | 151 | 145 |
Bissot | 129 | 121 |
Bloom | 169 | 148 |
Bloom | 169 | 148 |
Bloom | 169 | 148 |
Bull | 185 | 121 |
Cabrio | 187 | 121 |
Cambrault | 154 | 145 |
Cambrault | 154 | 145 |
Cambrault | 154 | 145 |
Cambrault | 148 | 100 |
Cambrault | 148 | 100 |
Chen | 110 | 108 |
Chung | 188 | 122 |
Colmenares | 119 | 114 |
Davies | 142 | 124 |
De Haan | 102 | 100 |
Dellinger | 186 | 121 |
Dilly | 189 | 122 |
Doran | 160 | 146 |
Doran | 160 | 146 |
Doran | 160 | 146 |
Ernst | 104 | 103 |
Errazuriz | 147 | 100 |
Errazuriz | 147 | 100 |
Everett | 193 | 123 |
Faviet | 109 | 108 |
Fay | 202 | 201 |
Feeney | 197 | 124 |
Fleaur | 181 | 120 |
Fox | 170 | 148 |
Fox | 170 | 148 |
SELECT LPAD(' ',2*(LEVEL-1)) || last_name org_chart,
employee_id, manager_id, job_id
FROM hr.employees
START WITH job_id = 'AD_VP'
CONNECT BY PRIOR employee_id = manager_id
SELECT LPAD(' ',2*(LEVEL-1)) || last_name org_chart,
employee_id, manager_id, job_id
FROM hr.employees
WHERE job_id != 'FI_MGR'
START WITH job_id = 'AD_VP'
CONNECT BY PRIOR employee_id = manager_id
SELECT LPAD(' ',2*(LEVEL-1)) || last_name org_chart,
employee_id, manager_id, job_id
FROM HR.employees
START WITH job_id = 'AD_PRES'
CONNECT BY PRIOR employee_id = manager_id AND
LEVEL <= 2