Breaking News

Script for database (Data Manipilation Language)

Example the table of database is IDENTITY :

CREATE TABLE IDENTITY(
NAMES VARCHAR(50),
AGE INTEGER,
ADDRESS VARCHAR(100));

This is script for insert, update and delete data from table of database:
  • Insertion
INSERT INTO Table_Name
VALUES (...., ...., ....)
or
INSERT INTO Table_Name (Field1, Field2,.....)
VALUES (...., ...., ....)
 Example:
INSERT INTO IDENTITY
VALUES ('Fuji', 20, 'Indonesia');

or

INSERT INTO IDENTITY (NAMES,AGE,ADDRESS)

VALUES ('Fuji', 20, 'Indonesia');

  • Update one row
UPDATE Table_Name
SET
        Field1 = ....,
        Field2 = ....
WHERE Conditions
Example:
UPDATE IDENTITY
SET
       AGE = 21,
      ADDRESS = 'Yogyakarta'
WHERE NAMES = 'Fuji';

  • Update all rows
UPDATE Table_Name

SET
        Field1 = ....,
        Field2 = ....


Example:
UPDATE IDENTITY
SET
       AGE = 21,
      ADDRESS = 'Yogyakarta'


  • Delete  one row
DELETE FROM Table_Name
WHERE Conditions
Example:
DELETE FROM IDENTITY
WHERE NAMES = 'Fuji';

  • Delete all rows
DELETE FROM Table_Name

Example:
DELETE FROM IDENTITY

No comments