Monday, July 9, 2018

Different Types of SQL Commands

SQL commands can be classified into following types:

·         DDL – Data Definition Language
·         DML – Data Manipulation Language
·         DQL – Data Query Language
·         DCL – Data Control Language
·         TCL – Transaction Control Language

1.    DDL (Data Definition Language): These commands used to work on the Structure or Definition of the data. Following are DDL commands:

a)   CREATE             -        used to create database and its objects.
b)   ALTER               -        used to alter the database structure
c)    DROP                -        used to drop the database objects.
d)   TRUNCATE       -        used to remove all data records along with resetting the identity i.e. removing the allocated space also.
e)   COMMENT          -        used to add comments
f)     RENAME            -        used to rename existing database objects.

 2.    DML (Data Manipulation Language): These commands used to work on the data itself. It helps in manipulating the data within the database tables. Following are DML commands:

a)   INSERT              -        used to insert data in database table
b)   UPDATE             -        used to update data in database table
c)    DELETE             -        used to delete data records.

 3.    DQL (Data Query Language): Deals with the data but only to retrieve the data. Following is DQL command:

a)   SELECT             -        used to query/select and retrieve the data records

 4.    DCL (Data Control Language): These commands control the data and mainly deals with providing/ revoking the rights, permissions and other controls of the database system. Following are the DCL commands:

a)   GRANT              -        assign privileges to user to use database.
b)   REVOKE             -        withdraw privileges to user to use database.
c)    DENY           -       deny user privileges on database such as using UPDATE statement on database tables.

 5.    TCL (Transaction Control Language): These commands deal with the transaction management in SQL server. Following are the TCL commands:

a)   COMMIT            -        commit a transaction.
b)   ROLEBACK         -       rollback uncommitted transactions in case of any error.
c)    SAVEPOINT       -        sets a save-point within a transaction.
d)   SET TRANSACTION     -        specify characteristics for the transaction.

Share This
Previous Post
Next Post

TekGrabs, established in 2017, is in the business of sharing Information. It provides news, articles and photos about the different technologies, inventions in different domains. Provides information on programming and databases.