Anda di halaman 1dari 2

CREATE DATABASE GUDANG USE GUDANG CREATE TABLE barang ( kode_barang VARCHAR(7) NOT NULL PRIMARY KEY, nama_barang

VARCHAR(20) NOT NULL, jenis_barang VARCHAR(15) NOT NULL, kode_suplier VARCHAR(7) NOT NULL ) INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO barang barang barang barang barang barang barang barang barang barang VALUES('BM01','Nuvo','Sabun','SP_001') VALUES('BM02','Pensil','Alat Tulis','SP_001') VALUES('BM03','Spidol','Alat Tulis','SP_001') VALUES('BM04','Supermi Gobang','Makanan','SP_001') VALUES('BM05','Taro','Snack','SP_001') VALUES('BK101','Kecap','Makanan','SP_001') VALUES('BK102','Teh','Minuman','SP_001') VALUES('BK103','Kerupuk Kijang','Makanan','SP_001') VALUES('BK104','Permen Kopiko','Permen','SP_001') VALUES('BK105','SGM 3','Susu','SP_001')

CREATE TABLE transaksi_barang_masuk ( kode_transaksi VARCHAR(7) NOT NULL PRIMARY KEY, tanggal_masuk VARCHAR(10) NOT NULL, kode_barang VARCHAR(5) NOT NULL, jumlah VARCHAR(15) NOT NULL, ) INSERT n') INSERT ') INSERT ) INSERT ) INSERT ') INTO transaksi_barang_masuk VALUES ('TR_001','26/3/2012','BM01','500 lusi INTO transaksi_barang_masuk VALUES ('TR_002','26/3/2012','BM02','1000 dos INTO transaksi_barang_masuk VALUES ('TR_003','26/3/2012','BM03','500 dos' INTO transaksi_barang_masuk VALUES ('TR_004','26/3/2012','BM04','500 dos' INTO transaksi_barang_masuk VALUES ('TR_005','26/3/2012','BM05','1000 dos

CREATE TABLE transaksi_barang_keluar ( kode_transaksi VARCHAR(7) NOT NULL PRIMARY KEY, tanggal_masuk VARCHAR(10) NOT NULL, kode_barang VARCHAR(7) NOT NULL, jumlah VARCHAR(15) NOT NULL, ) INSERT in') INSERT ') INSERT s') INSERT k') INSERT ') INTO transaksi_barang_keluar VALUES ('TRK_001','9/5/2012','Bk101','10 lus INTO transaksi_barang_keluar VALUES ('TRK_002','9/5/2012','Bk102','50 dos INTO transaksi_barang_keluar VALUES ('TRK_003','9/5/2012','Bk103','200 do INTO transaksi_barang_keluar VALUES ('TRK_004','9/5/2012','Bk104','50 pac INTO transaksi_barang_keluar VALUES ('TRK_005','9/5/2012','Bk105','50 dos

CREATE TABLE stock_barang ( kode_barang VARCHAR(7) NOT NULL PRIMARY KEY, kode_pegawai VARCHAR(7) NOT NULL,

tanggal_pengecekan VARCHAR(10) NOT NULL, ) INSERT INSERT INSERT INSERT INSERT INTO INTO INTO INTO INTO stock_barang stock_barang stock_barang stock_barang stock_barang VALUES VALUES VALUES VALUES VALUES ('Bm01','P01','4/4/2011') ('Bm02','P01','4/4/2011') ('Bm03','P01','4/4/2011') ('Bm04','P02','4/4/2011') ('Bm05','P02','4/4/2011')

CREATE TABLE pegawai ( kode_pegawai VARCHAR(7) NOT NULL PRIMARY KEY, nama_pegawai VARCHAR(10) NOT NULL, alamat_pegawai VARCHAR(20) NOT NULL, kode_transaksi VARCHAR(7) NOT NULL, ) INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO pegawai pegawai pegawai pegawai pegawai pegawai pegawai pegawai pegawai pegawai VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES ('P01','Dedi','Salatiga','TR_001') ('P02','Adi','Semarang','TR_002') ('P03','Mitha','Suruh','TR_003') ('P04','Stephen','Salatiga','TR_004') ('P05','Michael','Salatiga','TR_005') ('K01','Yunita','Semarang','TRK_001') ('K02','Aini','Ambarawa','TRK_002') ('K03','Renita','Salatiga','TRK_003') ('K04','Bagus','Suruh','TRK_004') ('K05','Naning','Salatiga','TRK_005')

CREATE TABLE gudang ( kode_gudang VARCHAR(7) NOT NULL PRIMARY KEY, nama_gudang VARCHAR(20) NOT NULL, ) INSERT INTO gudang VALUES ('G01','Keb. Sekunder') INSERT INTO gudang VALUES ('G02','ATK') INSERT INTO gudang VALUES ('G03','Keb. Primer') CREATE TABLE penyimpanan ( kode_pegawai VARCHAR(7) NOT NULL PRIMARY KEY, kode_gudang VARCHAR(7) NOT NULL, ) INSERT INTO penyimpanan VALUES ('P01','G01') INSERT INTO penyimpanan VALUES ('P02','G02') INSERT INTO penyimpanan VALUES ('K01','G03') SELECT * FROM suplier CREATE TABLE suplier ( kode_suplier VARCHAR(7) NOT NULL PRIMARY KEY, nama_suplier VARCHAR(20) NOT NULL, alamat_suplier VARCHAR(50) NOT NULL, ) INSERT INTO suplier VALUES ('SP_001','Bambang Perkasa','Jl Pantirejo no 37 Salat iga')