Praktikum 22 September 2015

Senin, September 28, 2015 kamusuka 0 Comments

create table mahasiswa (
nim char(10),
nama varchar(15),
alamat varchar(20),
kota varchar(15),
constraint pk_mahasiswa primary key (nim)
);


alter table mahasiswa add kodepos varchar(8)
alter table mahasiswa alter column kodepos type char(10)


create table matakuliah (
kode_mk char(6),
nama_mk varchar(10),
semester char(1),
sks numeric(2)
);


alter table matakuliah add constraint pk_matakuliah unique(kode_mk)

create table nilai (
nim char(9),
kode_mk char(6),
nilai numeric,
constraint fk_nim foreign key (nim) references mahasiswa (nim),
constraint fk_kodemk foreign key (kode_mk) references matakuliah (kode_mk)
);

select * from nilai

0 komentar :