CREATE TABLE barang (
kode_barang char(6),
satuan_barang varchar(20),
nama_barang varchar(25),
stok_barang numeric(4)
);
alter table barang add constraint pk_barang unique (kode_barang)
;
alter table barang alter column nama_barang char(50)
;
CREATE TABLE suplier (
kode_suplier char(6),
nama_suplier varchar(6),
tlp_suplier varchar(6),
);
alter table suplier add constraint pk_suplier unique (kode_suplier)
;
alter table suplier add alamat_suplier varchar(50)
;
alter table suplier drop column alamat_suplier
;
alter table suplier rename column tlp_suplier to telepeon_suplier
;
CREATE TABLE pasok (
kode_pasok char(10),
kode_barang char(6),
kode_suplier char(6),
tanggal_pasok date,
jumlah_pasok numeric,
constraint pk_pasok primary key (kode_pasok),
constraint fk_pasok_barang foreign key (kode_barang) references barang (kode_barang),
constraint fk_pasok_suplier foreign key (kode_suplier) references suplier (kode_suplier)
);
select *from barang;
select *from suplier;
select *from pasok;
sp_columns barang;
sp_columns suplier;
sp_columns pasok;



Tidak ada komentar:
Posting Komentar