create database A1_0032;
use A1_0032;
create table basis_data (nim varchar(10)primary key,nama varchar(15),kota varchar(10),tgl_lhr date, sex char(1));
desc basis_data;
insert into basis_data values('1001530032','Ahmad Quzwaini','Demak','1992-10-14','L');
insert into basis_data values('1001530033','Ahmad Quzwaini','Demak','1992-10-14','L');
select*from basis_data;
*mengganti data
update nama_tabel
set kolom_1=nilai_baru1,
................................
kolom_n=nilai_barun
where [kondisi];
ex:
update basis_data
set kota='Semarang'
where nim='1001530032';
*beberapa data sekaligus :
update basis_data
set nama='ahmad',
kota='jakarta',
sex='P',
tgl_lhr='1992-01-10'
where nim='1001530033';
*satu kolom dalam data berbeda (primary key yang berbeda)
update basis_data
set kota='jakarta'
where nim='1001530033' or '1001530032';
use A1_0032;
create table basis_data (nim varchar(10)primary key,nama varchar(15),kota varchar(10),tgl_lhr date, sex char(1));
desc basis_data;
insert into basis_data values('1001530032','Ahmad Quzwaini','Demak','1992-10-14','L');
insert into basis_data values('1001530033','Ahmad Quzwaini','Demak','1992-10-14','L');
select*from basis_data;
*mengganti data
update nama_tabel
set kolom_1=nilai_baru1,
................................
kolom_n=nilai_barun
where [kondisi];
ex:
update basis_data
set kota='Semarang'
where nim='1001530032';
*beberapa data sekaligus :
update basis_data
set nama='ahmad',
kota='jakarta',
sex='P',
tgl_lhr='1992-01-10'
where nim='1001530033';
*satu kolom dalam data berbeda (primary key yang berbeda)
update basis_data
set kota='jakarta'
where nim='1001530033' or '1001530032';
No comments:
Post a Comment
Your comments are very valuable