Rabu, 09 November 2011

Basis Data Modul 9 (Query)

select last_name, hire_date
from employees
where department_id = (select department_id
                       from employees
                       where last_name = 'Zlotkey')
and last_name <> 'Zlotkey'
order by last_name;


select employee_id, last_name, salary
from employees
where salary > (select avg(salary) FROM employees)
order by salary asc;


select employee_id, last_name
from employees
where department_id in (select department_id
                       from employees
                       where last_name like '%u%');


select e.last_name, e.department_id, e.job_id
from employees e
where e.department_id in (select department_id
                          FROM departments
                          where location_id = 1700);


select e.last_name, e.salary
from employees e
where employee_id in (select manager_id
                    from employees
                    where last_name = 'King');


select department_id, last_name, job_id
from employees
where department_id in (select department_id
                        from departments
                        where department_name = 'Executive');

2 komentar: