beranda

Minggu, 18 Maret 2012

BELAJAR DASAR MYSQL part 3

SINTAKS DML

Contoh dari table tamu :
CREATE TABLE tamu(
id INT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL,
nama VARCHAR(20) NULL,
PESAN LONGTEXT
);


INSERT INTO TABLE
INSERT INTO tamu (id, nama, pesan) VALUE ('1', 'adi', 'saya adi');
INSERT INTO tamu (id, nama, pesan) VALUE ('3', 'coki', 'saya coki'),('4', 'dodi', 'saya dodi');
INSERT INTO tamu VALUE ('7', 'gani', 'saya gani');
INSERT INTO tamu (id) VALUES ('9');


DELETE FROM TABLE
DELETE FROM tamu;


DELETE FROM tamu WHERE id='1';
DELETE FROM tamu WHERE id in (3);
DELETE FROM tamu WHERE id in (4,7);



DELETE FROM tamu WHERE id <=’9';


UPDATE TABLE
UPDATE tamu SET id='11' WHERE id='1';


UPDATE tamu SET id='23', nama='jajang' WHERE id='3';


UPDATE tamu SET nama='jali' WHERE id in (3,4);



UPDATE tamu SET nama='zzzz';

Tidak ada komentar:

Posting Komentar