SQL Commands

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:
  1. CREATE TABLE TB_NAME (Column1 datatype,column2 datatype)  
ALTER: 
Alter the table structure of the database.
Syntax:
  1. ALTER TABLE TB_NAME ADD column_Name datatype  
DROP:
Delete Objects from the database.
Syntax:
  1. DROP TABLE TB_NAME  
TRUNCATE:
Delete the data inside a table, including all spaces allocated for the records.
Syntax:
  1. TRUNCATE TABLE TB_NAME  
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:
  1. INSERT INTO TB_NAME VALUES('value1','value2')  
UPDATE:
“UPDATE” statement is used to modify the existing records in a table. 
Syntax:
  1. UPDATE TB_NAME SET Column_Name='value' WHERE CONDITION  
DELETE:
“DELETE” statement is used to delete records from the table.
Syntax:
  1. DELETE FROM TB_NAME