Nowy dokument tekstowy.txt

(1 KB) Pobierz
1.
SELECT *
FROM employee
where salary > (select avg(salary)*2 from employee)
order by salary desc
2.
SELECT emp_lname, emp_fname, salary
FROM employee as e
where emp_id <> manager_id and e.salary > (select max(salary)*0.9 from employee where employee.dept_id=e.dept_id)
order by dept_id 
3.
SELECT *
FROM product
where unit_price>(select min(unit_price) from product where size = 'Medium')
4.
SELECT *
FROM product
where unit_price>(select max(unit_price) from product where size = 'Medium')
3.
SELECT *
FROM product
where unit_price> any (select unit_price from product where size = 'Medium')
4.
SELECT *
FROM product
where unit_price> all (select unit_price from product where size = 'Medium')
5.
SELECT *
FROM employee
where  emp_id in (select sales_rep from sales_order)
5.
SELECT *
FROM employee as e
where  exists (select sales_rep from sales_order where e.emp_id =sales_rep)
6.
SELECT state, count(*)
FROM  customer as c left outer join sales_order as s on c.id = s.cust_id
where s.cust_id is null
group by state
7.
select dept_name, sum(salary), count(*)
FROM  employee as e, department as d
where e.dept_id = d.dept_id
group by dept_name
having sum(salary)>= all (select sum(salary) from employee as e, department as d where e.dept_id = d.dept_id group by dept_name)
8.
select dept_name, emp_lname, emp_fname, salary, d.dept_id
from employee as e, department as d
where salary < (select avg(salary) from employee where employee.dept_id = d.dept_id)
order by d.dept_id, salary
Zgłoś jeśli naruszono regulamin