Types of SQL Statements – Karan Rajpoot

  • Post Author:
  • Post Category:SQL
  • Post Comments:4 Comments
                                                          Types of SQL Statements

In this article, you will get to know the types of SQL statements which is used to manage any kind of databases.

The Types of SQL statements can be categorized into the following four ways: –

1) DDL ( Data Definition Language)

2) DML ( Data Manipulation language)

3) DCL ( Data Control Language)

4) TCL ( Transaction Control Language) 

Now we will understand each of the above statements with examples: –

1) DDL ( Data Definition Language): – 

The DDL statement provides commands for defining relation schemas, that is for creating tables, indexes, sequences and so on and also commands for dropping, altering renaming objects.

a) CREATE: – It is used to create objects in the database.

Example: –

Object Creation
Object Creation

b) ALTER: – It is used to alter the structure of the database.

Example: –

alter the structure of database
Alter the structure of the database

c) RENAME: – To rename an object.

Advertisement
Example: –

Rename object of the database
Rename of a tablespace



d) DROP: – This command is used to delete the objects from the database.

Example: –

drop object from the database
Drop object from the database

2) DML (Data Manipulation Language): –

The DML statements are used to alter or modification of the database. The databases are managed with the help of below statements.

a) SELECT: – It is used to retrieve the data from the database.

Example: –

Retrieve the data from the database
Retrieve the data from the database

b) INSERT: – This command is used to insert the data into a table.

Example: –

Insert data into a table
Insert data into a table

c) UPDATE: – This command is used to update the existing records within the table.

Example: –

Update the existing record
Updated the existing record

3) DCL (Data Control language): –

The DCL statements are used to Grant the permission from the user or to revoke the already given permission from the user.
a) GRANT: – This command is used to give the permission of the user.
Example: –
Grant Permission
Grant Permission
b) Revoke: – This command is used to revoke the already given permission from the user.
Example: –
Revoke Permission
Revoke Permission

4) TCL (Transaction Control Language): –

The TCL statement is used to commit the transaction after work done and restore the database to its original stage since the last commit.


a) COMMIT: – 


Commit the transaction
Commit the transaction

b) ROLLBACK: –

Rollback the transaction
Rollback the transaction

Thank You!!


Advertisement

This Post Has 4 Comments

  1. Agnes

    Hello there! I simply want to offer you a huge thumbs
    up for the great information you have here on this post.

    I’ll be coming back to your site for more soon.

Leave a Reply