(TUGAS) Membuat Table dengan Foreign Key

Jumat, September 18, 2015 0 Comments Category :



CREATE TABLE BARANG (
kode_barang char(5),
nama_barang char(20),
satuan_barang char(5),
stok_barang numeric(10),
constraint pk_kodebarang primary key(kode_barang)
);


CREATE TABLE PASOK (
kode_pasok char(5),
kode_barang char(5),
kode_suplier char(5),
tanggal_pasok date,
jumlah_pasok numeric(10),
constraint pk_suplier primary key (kode_suplier),
constraint fk_kodebarang foreign key(kode_barang)
References BARANG (kode_barang)
);


CREATE TABLE SUPLIER (
kode_suplier char(5),
nama_suplier varchar(30),
telp_suplier numeric(10),
constraint fk_kodesuplier foreign key(kode_suplier)
References PASOK (kode_suplier)
);


SELECT * FROM BARANG;
SELECT * FROM PASOK;
SELECT * FROM SUPLIER;

RELATED POSTS

0 komentar

Fell free to comments.