Minggu, 23 Oktober 2016

Praktikum SQL (5)












select*from pasok;
select*from barang;

update pasok set jumlah_pasok ='500' where kode_pasok = 'pas005';
insert into pasok values ('pas003','brg001','sup003','02-11-2015',100);
insert into pasok values ('pas004','brg001','sup003','05-12-2015',150);
insert into pasok values ('pas005','brg002','sup003','12-21-2015',500);
insert into pasok values ('pas006','brg003','sup002','11-21-2016',500);
insert into pasok values ('pas007','brg002','sup002','07-25-2016',200);
insert into pasok values ('pas008','brg002','sup001','05-21-2016',80);

select kode_barang, Avg (jumlah_pasok) as jumlah
from pasok
group by kode_barang

select kode_barang, count (jumlah_pasok) as jumlah
from pasok
group by kode_barang

select kode_pasok, jumlah_pasok 
from pasok
order by jumlah_pasok desc

select kode_pasok, jumlah_pasok 
from pasok
order by jumlah_pasok asc

select kode_suplier,
count (jumlah_pasok) as cacah_pasok
from pasok
group by kode_suplier
having count (*)=3

select kode_barang,kode_suplier,jumlah_pasok
from pasok
where jumlah_pasok between 50 and 150

select kode_barang,kode_suplier,jumlah_pasok
from pasok
where jumlah_pasok in(50,100)
order by jumlah_pasok 

select*from suplier;
insert into suplier values ('sup004','aldi','112233','jalan mangga besar no 15');
insert into suplier values ('sup005','andika','778899','jalan anggur no 13');
insert into suplier values ('sup006','pahang','556644','jalan avocado no 14');

select*from suplier
where alamat_suplier like '%mangga%'

select*from suplier
where alamat_suplier not like '%mangga%'



Tidak ada komentar:

Posting Komentar