Kamis, 23 Maret 2017

SQL Tugas ke-3



Assalamu'alaikum Wr.Wb
Baik, disini saya akan memaparkan bagaimana Tugas ke-3 dari Pak Dosen Arif Setiawan
Dari database kemarin..



1.       Edit table barang, tambahkan 1 field tanggal kadaluwarsa
    alter table barang add kadaluwarsa date
 
 

2.        Isi tanggal kadaluwarsa

   update barang set kadaluwarsa='04/04/2016' where kdbrg='001'
   update barang set kadaluwarsa='05/05/2018' where kdbrg='002'
   update barang set kadaluwarsa='06/06/2019' where kdbrg='003'
   update barang set kadaluwarsa='07/07/2020' where kdbrg='004'
update barang set kadaluwarsa='08/08/2017' where kdbrg='005'
 
3.        Tampilkan tanggal kadaluwarsa
    select * from barang
 

4.        Rubah tanggal kadaluarsa yang tahun 2016 menjadi tanggal 2017
    update barang set kadaluwarsa='12/08/2017' where kdbrg='001'
 
5.        Rubah tanggal kadaluwarsa yang bulan mei, menjadi bulan agustus
   update barang set kadaluwarsa='08/08/2017' where kdbrg='002'

6.        Edit table supplier tambahkan 1 field jenis produk
   alter table Supplier add jenisproduk varchar(25)
 

7.        Isi jenis produk
 
update Supplier set jenisproduk='mie instan' where kdsup='sup001'
update Supplier set jenisproduk='shampo' where kdsup='sup002'
update Supplier set jenisproduk='pasta gigi' where kdsup='sup003'
update Supplier set jenisproduk='rokok' where kdsup='sup004'
update Supplier set jenisproduk='susu bayi' where kdsup='sup005'
update Supplier set jenisproduk='mie instan' where kdsup='sup006'
update Supplier set jenisproduk='shampo' where kdsup='sup007'
update Supplier set jenisproduk='sabun mandi' where kdsup='sup008'
update Supplier set jenisproduk='rokok' where kdsup='sup009'
update Supplier set jenisproduk='susu bayi' where kdsup='sup010'

8.        Tampilkan semua jenis produk
    select * from Supplier

 
9.        Hapus untuk jenis produk mie instan
   delete from Supplier where jenisproduk='mie instan'

 
10.    Rubah jenis produk, dari sabun mandi menjadi sabun cuci
 
       update supplier set jenisproduk='sabun cuci' where kdsup='sup008'

 









Sekian..
Wassalamualaikum Wr.Wb 😍






Tidak ada komentar:

Posting Komentar