Types of SQL commands

If you are a data analyst or a software engineer, you must be definitely using SQL queries for your data related requirements. In this post, let's take a look at the various types of SQL commands along with their examples.

There are 4 major categories or types of SQL commands. These are:

1. Data Definition Language (DDL)
2. Data Manipulation Language (DML)
3. Data Control Language (DCL)
4. Transaction Control Language (TCL)


Let's take a look at each of the types.

1. Data Definition Language

This type comprises of SQL commands which are used to define the the data. Example SQL commands in this category are
a. CREATE
b. ALTER
c. DROP
d. RENAME
e. TRUNCATE
f. COMMENT


2. Data Manipulation Language

This category of SQL commands are used to manipulate the data. Some of the examples of this category of SQL commands are:

a. SELECT
b. INSERT
c. UPDATE
d. DELETE
e. MERGE
f. CALL
g. EXPLAIN PLAN
h. LOCK TABLE



3. Data Control Language

This category of commands are used to control the access of data. The examples of this type of commands are

a. GRANT
b. REVOKE


4. Transaction Control Language

This category of commands are used to control the SQL transactions. Some of the examples of this type of commands are:

a. COMMIT
b. ROLLBACK
c. SAVEPOINT
d. SET
e. TRANSACTION

Hope you found this article useful. Let me know your thoughts on comments below.



Post a Comment

0 Comments