Professional Documents
Culture Documents
-----------------------Select last_name
From employees
Where salary > 11000;
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
Select last_name
From employees
Where job_id =
(Select job_id
From employees
Where employee_id = 141);
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
Kalau ada having selalu ada group by
Select department_id,MIN(salary)
From employees
Group by department_id
Having MIN(salary) >
(Select MIN(salary)
From employees
Where department_id = 50)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
1. carilah nama vendor yang harga barangnya termurah
Select v.vend_name,p.prod_price
From vendors v,products p
Where v.vend_id = p.vend_id
And p.prod_price = (Select MIN(prod_price)from products);
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
2. tampilkan kota-kota dari vendor produk jetpack harganya dibawah 55
Select vend_city,prod_name,prod_price
From vendors v,products p
Where v.vend_id=p.vend_id
And prod_name like '%JetPack%'
And prod_price < (Select prod_price From products Where prod_price=55);
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
3. siapa sajakah customer yang melakukan order tanggal 01-09-05
select c.cust_name, o.order_date from customers c join orders o on(o.cust_id=c.c
from vendors v join (select vend_id, sum(prod_price) harga from products group b
y vend_id) h
on(h.vend_id=v.vend_id)
where h.harga > (select avg(prod_price) from products);
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
14. sebutkan vendor-vendor yang punya catatan produk paling kecil dari rata-rata
panjang komentar untuk produk dan harga barangnya diatas rata-rata
select distinct(v.vend_name)
from vendors v join products p
on(p.vend_id=v.vend_id)
join productnotes pn
on(pn.prod_id=p.prod_id)
where length(pn.note_text) < (select avg(length(note_text)) from productnotes)
and p.prod_price > (select avg(prod_price) from products);
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
15. negara-negara mana saja yang vendornya pernah mensupply produk dengan qty an
tara 3-10
select distinct(v.vend_country)
from vendors v join products p
on(p.vend_id=v.vend_id)
join orderitems oi
on(oi.prod_id=p.prod_id)
where oi.quantity between 3 and 10;
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
16. sebutkan produk-produk yang satu produsen dengan jeetpack 100 dan harganya d
ibawah rata-rata
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
17. sebutkan vendor-vendor yang pernah mensuply product dengan description oil c
an,red dan harganya diatas rata-rata
select v.vend_name, p.prod_desc, p.prod_price
from vendors v join products p
on(p.vend_id=v.vend_id)
where p.prod_desc like '%Oil can, red%'
and p.prod_price > (select avg(prod_price) from products);
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::
18. sebutkan vendor-vendor yang satu negara dengan customer wascals
SELECT vend_name, vend_country
FROM vendors
WHERE vend_country = (SELECT cust_country
FROM customers