SQL Languages

Data Definition Language (DDL)

DDL changes the structure of the table like creating a table,

deleting a table, altering a table, etc.

All the command of DDL are auto-committed that means

it permanently save all the changes in the database.

Here are some Commands that come under

DDL

CREATE

ALTER

DROP

TRUNCATE

a. CREATE It is used to create a new table in the database.

b. DROP: It is used to delete both the structure and record stored in the 

table.

C. ALTER: It is used to alter the structure of the database

This change could be either to modify the characteristics

of an existing attribute or probably to add a new attribute.

d. TRUNCATE: It is used to delete all the rows from the table and free the 

space containing the table.

DATA MANIPULATION LANGUAGE (DML)

DML is an abbreviation for Data Manipulation Language

List of DML Commands in SQL

SELECT: Command to fetch data or values from the database.

INSERT: Command to add new or fresh value to the database.

UPDATE: Command to change or update the present/existing

data to a newer value inside the database.

DELETE: Command to remove or delete the values or data

information from the database’s current table.

MERGE: Command to merge two or more data tables inside a database

The Syntax for DML Commands.

INSERT

The INSERT query command in SQL provides a way to add new rows of 

information or data inside a specific database of the RDBMS.

UPDATE

The Update command provides a way to make changes/update or modify 

the values present in a table’s column.

DELETE

Delete command provides a way to delete a single column or multiple 

columns from a table’s specific row.

Data Control Language(DCL)

DCL commands are used to grant and take back authority from any 

database use.

a. Grant: It is used to give user access privileges to a database.

b. Revoke: It is used to take back permissions from the user.

Transaction Control Language (TCL)

Transaction Control Language commands are used to manage transactions in 

the database. These are used to manage the changes made by 

DML-statements. It also allows statements to be grouped together into logical 

transactions.

Examples of TCL commands -database to last committed state. It is also used  

with the savepoint command to jump to a save point in a 

COMMIT: Commit command is used to permanently save any transaction into

the database. ROLLBACK: This command restores the transaction.

SAVEPOINT: Savepoint command is used to temporarily save a transaction so 

that you can rollback to that point whenever necessary.

Data Query Language (DQL)

DQL statements are used for performing queries on the data within schema 

objects. The purpose of the DQL Command is to get some schema relation

based on the query passed to it.

Example of DQL:

SELECT – is used to retrieve data from the database

Leave a Reply

Your email address will not be published. Required fields are marked *