Vous êtes sur la page 1sur 3

Nama : Yeni Rimayanti

NIM : 5211161027

Kelas : A

 Membuat Table
- Create Table Barang (Kode_brg char (8) not null primary key, Nama_brg varchar
(20), Hrg_satuan currency, Stok integer, Tgl_beli date, Tgl_exp date)

- Create Table Jual (Id_jual char (8) not null primary key, Kode_brg varchar (8),
Nama_brg varchar (20), Hrg_jual currency, Jumlah varchar (3), Tgl_jual date,
Tot_beli currency, Tot_jual currency)

- Create Table Supplier (Kd_supplier char (5) not null primary key, Nama_supplier
varchar (20),Kode_brg varchar (8), Alamat varchar (20), Telp varchar (15), Email
varchar (15))

 Merecord Data

Tabel Barang
1. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0001', 'Taro snack', '2000', '20', '12/10/2017','12/10/18')
2. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0002', 'Cheetos', '2500', '50', '12/11/2017','17/10/18')
3. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0003', 'Chitato', '5000', '12', '19/09/2017','17/10/18')
4. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0004', 'Momogi', '500', '20', '19/12/2017','18/10/18')
5. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0005', 'Oreo', '1000', '5', '29/12/2017','05/10/18')
6. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0006', 'Biskuat', '2000', '3', '14/12/2017','05/12/18')
7. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0007', 'Milkita', '1500', '4', '14/03/2017','05/02/18')
8. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0008', 'Chocolatos', '500', '11', '14/10/2017','05/09/18')
9. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0009', 'Richeese', '1000', '15', '04/10/2017','05/10/18')
10. Insert Into Barang (Kode_brg, Nama_brg, Hrg_satuan, Stok, Tgl_beli, Tgl_exp)
values ('B0010', 'Better', '2000', '20', '08/10/2017','05/12/18')
Tabel Jual
1. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values ('P0001', 'B0001', 'Taro snack', '2000', '10', '12/12/2017', ‘20000’,
‘20000’)
2. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values ('P0002', 'B0002', 'Cheetos', '3000', '10', '12/12/2017', ‘25000’,
‘30000’)
3. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values ('P0003', 'B0003', 'Chitato', '6000', '5', '12/11/2017', ‘25000’,
‘30000’)
4. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values ('P0004', 'B0004', 'Momogi', '500', '6', '12/01/2018', ‘2400’, ‘3000’)
5. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values ('P0005', 'B0002', 'Cheetos', '3000', '15', '12/12/2017', '37500',
'45000')
6. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values ('P0006', 'B0006', 'Biskuat', '2500', '1', '14/03/2018', ‘2000’, ‘2500’)
7. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values ('P0007', 'B0007', 'Milkita', '2500', '2', '24/01/2018', ‘4000’, ‘5000’)
8. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values , ('P0008', 'B0008', 'Chocolatos', '1000', '9', '24/04/2018', ‘4500’,
‘9000’)
9. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values ('P0009', 'B0009', 'Richeese', '1500', '8', '25/05/2018', ‘8000’,
‘12000’)
10. Insert Into Jual (Id_jual, Kode_brg, Nama_brg, Hrg_jual, Jumlah, Tgl_jual, Tot_beli,
Tot_jual) values ('P0010', 'B0010', 'Better', '2500', '11', '15/06/2018', ‘22000’,
‘27500’)

Tabel Supplier
1. Insert into Supplier (Kd_supplier,Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup001', 'Toko Rani', 'B0001', 'Jl Anggrek no13', '089827345198',
'rani8@gmail.com')
2. Insert into Supplier (Kd_supplier, Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup002', 'Toko Suci', 'B0002', 'Jl Merpati no 105', '087890820340',
'suci@gmail.com')
3. Insert into Supplier (Kd_supplier,Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup003', 'Toko Subur', 'B0003', 'Jl Melati no 12', '081356781243',
'sub.jkt@gmail.com')
4. Insert into Supplier (Kd_supplier, Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup004', 'Toko Asri', 'B0004', 'Jl Mawar no 12', '081809905579',
'asri@gmail.com')
5. Insert into Supplier (Kd_supplier, Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup005', 'Toko Rizki', 'B0005', 'Jl Soedirman', '089870675432',
'riz05@gmail.com')
6. Insert into Supplier (Kd_supplier, Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup006', 'Toko Makmur', 'B0006', 'Jl Ahmad Yani no 123', '08976523451',
'maju@gmail.com')
7. Insert into Supplier (Kd_supplier, Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup007', 'Toko Bagus', 'B0007', 'Jl Diponegoro no 14', '087967893452',
'bgs06@gmail.com')
8. Insert into Supplier (Kd_supplier, Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup008', 'Toko Jaya', 'B0008', 'Jl Tulip no 10', '087985760980',
'Jaya@gmail.com')
9. Insert into Supplier (Kd_supplier, Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup009', 'Toko Maju', 'B0009', 'Jl Cempaka no 09', '081827390840',
'maju09@gmail.com')
10. Insert into Supplier (Kd_supplier, Nama_supplier, Kode_brg, Alamat, Telp, Email)
values ('Sup010', 'Toko Sari', 'B0010', 'Jl Cemara no 100', '083845098654',
'sr010@gmail.com')

Perintah SQL:

a. Select *from Supplier where Alamat='Bandung'

b. Update Barang set Hrg_satuan=1000 where Hrg_satuan=500

c. Select max (Nama_brg) As Nama_brg_max from Jual

d. Select Tot_jual-Tot_beli As Tot_untung from Jual

e. Select *from Barang where tgl_exp=now

f. Update supplier set Alamat='Jl Ahmad Dahlan no 11' where


Kd_supplier='Sup001'

g. Select *from Barang where stok >5

h. Select max (Hrg_jual) As Hrg_jual_max from Jual

i. Select Kd_supplier from Supplier where Kode_brg='B0003'

j. Select *from Barang where Tgl_beli=30/10/2017

Vous aimerez peut-être aussi