SQL COMMANDS – DDL, DML, TCL, DCL
In this blog, I will explain the DDL and DML Commands.
DDL Command:
DDL Means Data Definition Language. It is used to create and modify the structure of database objects in the database.
CREATE:
The “CREATE TABLE” statement is used to create a new table in a database.
Syntax:
- CREATE TABLE TB_NAME (Column1 datatype,column2 datatype)
ALTER:
Alter the table structure of the database.
Syntax:
- ALTER TABLE TB_NAME ADD column_Name datatype
DROP:
Delete Objects from the database.
Syntax:
TRUNCATE:
Delete the data inside a table, including all spaces allocated for the records.
Syntax:
DML Commands:
DML Means Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data to the database.
INSERT:
The “INSERT INTO” statement is used to insert new records in a table.
Syntax:
- INSERT INTO TB_NAME VALUES('value1','value2')
UPDATE:
“UPDATE” statement is used to modify the existing records in a table.
Syntax:
- UPDATE TB_NAME SET Column_Name='value' WHERE CONDITION
DELETE:
“DELETE” statement is used to delete records from the table.
Syntax: