1. Insert new Row
insert data bisa secara implisit dan eksplisit
implisit -> nama kolom disebutin
INSERT INTO TableSomething (ColA, ColB) VALUES(1, 2);
eksplisit ga sebutin nama kolom
INSERT INTO TbSomething VALUES (1, 2, NULL);
Insert data bisa dari table lain:
INSERT INTO TbA (SELECT x FROM tableY WHERE ID > 1);
2. Update data
UPDATE tableName SET colName = value WHERE condition
bisa dimasukin subquery juga loh~
UPDATE tbName SET colName = (SELECT x FROM tbY where condition);
3. Delete data
DELETE FROM tbName WHERE condition;
DCL:
1. Truncate data -> sm kyk delete, tp dia autocommit
TRUNCATE TABLE tbA;
Database Transaction
- COMMIT
- ROLLBACK
FOR UPDATE -> dimasukin di query select, fungsinya agar user lain gabisa edit data yg lg di select sm 1 user
0 comments:
Post a Comment