przygotowanie do drugiego kolokwium


select d.name, j.function from employee e, job j, department d where e.job_id = j.job_id and e.department_id = d.department_id group by j.function, d.name order by 1, 2;

select d.name, j.function from employee e, job j, department d where e.job_id = j.job_id and e.department_id = d.department_id order by 1, 2;

select d.name, j.function, min(e.hire_date), max(e.salary), count(*) from employee e, job j, department d where e.job_id = j.job_id and e.department_id = d.department_id group by j.function, d.name having count(*) > 1 and max(e.salary) > 2000 order by 1, 2;

select first_name, last_name from employee where department_id = (select department_id from employee where last_name = 'TURNER' ) AND last_name != 'TURNER';

select first_name, last_name from employee where department_id = 30;

select last_name, first_name, NAME || ' (' || d.department_id || ')', salary
from department d, employee e
where e.department_id = d.department_id and commission > (select avg(commission) from employee e2 where e2.department_id = e.department_id);

select last_name, first_name, employee_id from employee emp where 3 < (select count(*) from customer cust where cust.salesperson_id = emp.employee_id );

select cust.name, cust.city from customer cust where city in (select regional_group from location);

select description, sum(quantity) from item i, product p where p.product_id = i.product_id group by p.description order by 2 desc;

select select sum(total) from sales_order where customer_id = 226;

select c.name, sum(total) from customer c, sales_order s where s.customer_id = c.customer_id group by c.name order by 2;

select first_name, last_name, name from employee e, customer c where e.employee_id = c.salesperson_id;

select first_name, last_name, sum(total) from employee e, customer c, sales_order s where e.employee_id = c.salesperson_id and s.customer_id = c.customer_id group by first_name, last_name order by 3;

select max(salary) from employee where job_id = 667;

select last_name, first_name, salary from employee e where e.salary = (select max(salary) from employee e2 where e.job_id = e2.job_id);

select name from department d, employee e where d.department_id = e.department_id group by name;

select min(salary) from employee where salary > 1500
union
select max(salary) from employee where salary < 1500;

select first_name, last_name, regional_group from employee e, department d,
location l where e.department_id = d.department_id and
d.location_id = l.location_id order by 2, 1;

select last_name, first_name from employee e, job j
where e.job_id = j.job_id and function = 'MANAGER' order by 1,2;

select distinct first_name, last_name
from employee e, department d, location l, customer c
where c.city = l.regional_group and c.customer_id = e.employee_id
and e.department_id = d.department_id and d.location_id = l.location_id;

select a.last_name, a.first_name, b.last_name, b.first_name
from employee a, employee b
where a.manager_id = b.employee_id
and a.salary > b.salary;

select e.first_name, e.last_name, c.name, p.description, i.actual_price
from employee e, customer c, sales_order s, item i, product p
where e.employee_id = c.salesperson_id and s.customer_id = c.customer_id
and s.order_id = i.order_id and i.product_id = p.product_id;

Wyszukiwarka

Podobne podstrony:
Zadania do drugiego kolokwium2011
47 Przygotowania do podróży
2 SZ Przygotowanie do negocjacji
kurs przygotowanie do negocjaci prolog
PRZYGOTOWANIE DO SPRAWDZIANU funkcja wymierna 2013 14 p
Przygotowanie do akredytacji porady praktyczne
TRZECIOTEŚCIK TESTY PRZYGOTOWUJĄCE DO OSKT TEST III DETEKTYW POZYTYWKA
09 Przygotowanie do medytacji

więcej podobnych podstron