Task Hierarchical Retrieval Solutions

http://dedyrw.staff.telkomuniversity.ac.id/2014/05/13/task-hierarchical-retrieval/

Laily Maryatul Khiftiyah / 6301124030 / DBD1201

Jawaban :

1.
select last_name
from employees
start with last_name = ‘Hunold’
connect by prior manager_id = employee_id;

select last_name
from employees
where last_name != ‘Lorentz’
start with last_name = ‘Lorentz’
connect by prior manager_id = employee_id;

2.
select e.last_name, e.salary, d.department_name
from employees e
join departments d
on (e.department_id=d.department_id)
start with e.last_name = ‘Mourgos’
connect by prior e.employee_id = e.manager_id;
3.
select e.last_name, e.employee_id, d.manager_id, department_name
from employees e
join departments d
on (e.department_id=d.department_id)
where e.job_id != ‘IT_PROG’
start with e.manager_id is null
connect by prior e.manager_id = e.employee_id
and e.last_name != ‘De Hann’;

4.

select e.last_name, e.employee_id, d.manager_id, department_name
from employees e
join departments d
on (e.department_id=d.department_id)
where last_name != ‘Chen’
start with e.manager_id =
(select manager_id from employees where last_name = ‘Chen’)
connect by prior e.employee_id=e.manager_id;

5.

select e.last_name, e.employee_id, e.manager_id, d.department_name, j.job_title
from jobs j
join employees e
on (j.job_id=e.job_id)
join departments d
on (e.department_id=d.department_id)
where e.department_id =
(select department_id
from employees
where last_name = ‘Zlotkey’
)
start with e.manager_id = (
select manager_id
from employees
where last_name = ‘Zlotkey’ )
connect by prior e.employee_id = e.manager_id;
6.
select e.last_name, e.employee_id, e.manager_id, d.department_id, j.job_title
from jobs j
join employees e
on (j.job_id=e.job_id)
join departments d
on (e.department_id=d.department_id)
where (d.department_id, j.job_id) =
(select department_id, job_id
from employees
where last_name = ‘Vargas’)
start with e.manager_id =
(select manager_id
from employees
where last_name = ‘Vargas’)
connect by prior e.employee_id = e.manager_id;

Leave a Reply

Your email address will not be published. Required fields are marked *