Anda di halaman 1dari 2

Perintah create

1 create table nama_table(

nim char(10) primary key,

nama varchar(50) not null,

jenis_kelamin enum(“L”,”P”),

prodi varchar(30) not null);

2 create table nama_table(

-> nim char(10) not null,


-> kode_mk char(15) not null,
-> NIDN char(10) not null,
-> primary key (nim,kode_mk,NIDN),
-> foreign key (nim) REFERENCES mahasiswa (nim),
-> foreign key (kode_mk) REFERENCES matakuliah (kode_mk),
-> foreign key (NIDN) REFERENCES dosen (NIDN));
Perintah insert

Insert into nama_table


-> values

-> ("colom1","colom2","colom3","colom4","colom5");

Perintah alter table

alter table nama_table add nama_table baru tipe data;

alter table nama_table drop nama_table yang akan di drop;

alter table nama_table change nama_table nama_table tipedata;

alter table nama_table rename nama_table baru;

perintah update

update nama_table set colom_update =50 where colom_kondisi='Indomie Goreng';

Perintah Select

select *from tbpenjualan;

select jumlah as "stok" from tbpenjualan;


select jumlah from tbpenjualan where jumlah >= 50;

select *,(jumlah*harga_satuan) as "total harga" from tbpenjualan;

Anda mungkin juga menyukai