Blog#3 : SQL Statements
In this blog, we will be going through different types of
SQL statements.
So let’s get started.
Types of SQL Commands.
SQL (Structured Query
Language) is the database language that is used to interact with the
database. As all the languages have some specific set of ground rules so does
SQL.
Today we will be going through the basic types of SQL
statements.
SQL statements are broadly classified into 5 categories.
1. Data Definition Language (DDL)
2.
Data Manipulation Language (DML)
3.
Data Control Language (DCL)
4.
Transaction Control Language (TCL)
5. Data Query Language (DQL)
Data Definition Language (DDL)
Data Definition Language (DDL) is used
to create and modify the structure of database objects in the database. In simple, we can say that the DDL command is used to define your database or preparing the structure of the database.
Examples of DDL statements.
1.
Create: To Create a Database or its objects
2.
Drop: To delete the database or its objects
3.
Alter: To modify the database or its objects
4.
Truncate: To remove all the data from a table
Data Manipulation Language (DML)
As the name suggests DML statements are used to manipulate the data in a Database /
Schema. DML statements will not change any structure of the database but only
the data in a table.
Examples of DML Statements.
1.
Insert: To insert the data into a table
2.
Update: To update the data in a table
3.
Delete: To delete the data in a table
Data
Control Language (DCL)
Data
Control Language (DCL) deals with allowing and removing the rights and the
permission to a user to access the database.
Examples of DCL commands:
1.
Grant: Gives user access privileges on the
database
2.
Revoke: Remove/Withdraw user access privileges
on the database
Transaction Control Language (TCL)
Transaction
Control Language (TCL) deals with the transaction happening in the database.
Examples for TCL commands:
1.
Commit: Marks are the transaction is completed.
2.
Rollback: Undo all the commands if any error
occurs
3.
Savepoint: Sets a save point for a transactions
Data Query Language (DQL)
Data
Query Language (DQL) deals with the retrieval of the data from the table.
Example of DQL statement:
1.
Select: Used to retrieve the data from the database

Comments
Post a Comment