use "201553003"
select *from barang
select *from pembelian
select *from penjualan
select *from supplier
select *from returjual
create table returjual(
No_retur varchar (10) primary key,
NoNota varchar (10),
TanggalRetur date,
JumlahRetur int,
KetCacat varchar (50),
foreign key (NoNota) references penjualan (Nonota))
1. Isi data, ambil dari tabel penjualan, 2 record untuk di retur
insert into returjual values
('RET001','JUAL001','2017/03/21',3,'rusak'),
('RET002','JUAL002','2017/03/19',5,'salah barang')
2. Browsing operasi matematika menggunakan SQL untuk penambahan stok barang
3. Alternative lain, Update stok barang
update barang set jumlah=75+25 where KdBrg='BRG003'
update barang set jumlah=200+50 where KdBrg='BRG004'
sebelum update:
sesudah diupdate:
4.Jumlah Retur tidak boleh melebihi jumlah jual
5. Tanggal Retur tdk boleh sebelum tanggal jual
6. Tambahkan 5 Data Retur
insert into returjual values
('RET003','JUAL003','2017/04/18',8,'Rusak'),
('RET004','JUAL004','2017/05/02',5,'Rusak'),
('RET005','JUAL005','2017/05/12',4,'Rusak'),
('RET006','JUAL006','2017/05/23',5,'Rusak'),
('RET007','JUAL007','2017/05/30',2,'Rusak')
hasil:
7. Update data Retur
update returjual set keterangan_cacat='salah barang' where No_retur='RET001'
update returjual set keterangan_cacat='Kadaluarsa' where No_retur='RET005'
update returjual set keterangan_cacat='kemasan cacat' where No_retur='RET003'
hasil:
8. Delete record 1 data retur
delete from returjual
where No_retur='RTR006'
hasil:
9. Tambahkan field Jenis_paket
alter table returjual
add jenis_paket varchar (20)
hasil:
10. Isi Jenis Paket
update returjual set jenis_paket='Tiki' where No_retur='RET001'
update returjual set jenis_paket='Lion' where No_retur='RET002'
update returjual set jenis_paket='JNE' where No_retur='RET003'
update returjual set jenis_paket='JNE' where No_retur='RET004'
update returjual set jenis_paket='Tiki' where No_retur='RET005'
update returjual set jenis_paket='POS' where No_retur='RET007'
hasil:
select *from barang
select *from pembelian
select *from penjualan
select *from supplier
select *from returjual
create table returjual(
No_retur varchar (10) primary key,
NoNota varchar (10),
TanggalRetur date,
JumlahRetur int,
KetCacat varchar (50),
foreign key (NoNota) references penjualan (Nonota))
1. Isi data, ambil dari tabel penjualan, 2 record untuk di retur
insert into returjual values
('RET001','JUAL001','2017/03/21',3,'rusak'),
('RET002','JUAL002','2017/03/19',5,'salah barang')
2. Browsing operasi matematika menggunakan SQL untuk penambahan stok barang
3. Alternative lain, Update stok barang
update barang set jumlah=75+25 where KdBrg='BRG003'
update barang set jumlah=200+50 where KdBrg='BRG004'
sebelum update:
sesudah diupdate:
4.Jumlah Retur tidak boleh melebihi jumlah jual
5. Tanggal Retur tdk boleh sebelum tanggal jual
6. Tambahkan 5 Data Retur
insert into returjual values
('RET003','JUAL003','2017/04/18',8,'Rusak'),
('RET004','JUAL004','2017/05/02',5,'Rusak'),
('RET005','JUAL005','2017/05/12',4,'Rusak'),
('RET006','JUAL006','2017/05/23',5,'Rusak'),
('RET007','JUAL007','2017/05/30',2,'Rusak')
hasil:
7. Update data Retur
update returjual set keterangan_cacat='salah barang' where No_retur='RET001'
update returjual set keterangan_cacat='Kadaluarsa' where No_retur='RET005'
update returjual set keterangan_cacat='kemasan cacat' where No_retur='RET003'
hasil:
8. Delete record 1 data retur
delete from returjual
where No_retur='RTR006'
hasil:
9. Tambahkan field Jenis_paket
alter table returjual
add jenis_paket varchar (20)
hasil:
10. Isi Jenis Paket
update returjual set jenis_paket='Tiki' where No_retur='RET001'
update returjual set jenis_paket='Lion' where No_retur='RET002'
update returjual set jenis_paket='JNE' where No_retur='RET003'
update returjual set jenis_paket='JNE' where No_retur='RET004'
update returjual set jenis_paket='Tiki' where No_retur='RET005'
update returjual set jenis_paket='POS' where No_retur='RET007'
hasil:


















