• DTM (Data Defined Languages) used to change the structure of the table Like creating the table, altering the table & Deleting the table.
All the commands in the DDL are auto Committed that means it permanently save all the changes in the database.
1. CREATE :
This command is used to create a new database or table.
Syntax:
CREATE TABLE table_name( columnl datatype, column2 datatype, column3 datatype,
Example:
CREATE TABLE Employee
EmployeelD int; FirstName varchar(255), LastName varchar(255), AddressLine varchar(255), City varchar(255)
);
2. UPDATE:
The UPDATE statement is used to modify the existing records in a table.
Syntax:
UPDATE table_name
SET colomn1 = value1, colomn2 = value2,..... WHARE CustomerID = 101;
Example:
UPDATE Customers
SET ContactName = 'naresh', City = 'hyd' WHERE CustomerID = 101;
3. DELETE :
The DELETE statement is used to delete the existing records in a table.
Syntax:
DELETE FROM table_name[WHERE condition];
Example:
DELETE Customers WHERE CuntomerName = "naresh";
4. TRUNCATE:
A truncate SQL statement is used to remove all rows (complete data) from a table. It is similar to the DELETE statement with no WHERE clause.
Syntax:
TRUNCATE TABLE table_name;
Example:
TRUNCATE TABLE Employee;