Types of SQL commands

by | Apr 7, 2024 | SQL | 0 comments

  • Data Definition Language (DDL) – to define and modify the structure of a database.
  • Data Manipulation Language (DML) – to access, manipulate, and modify data in a database.
  • Data Control Language (DCL) – to control user access to the data in the database and give or revoke privileges to a specific user or a group of users.
  • Transaction Control Language (TCL) – to control transactions in a database.
  • Data Query Language (DQL) – to perform queries on the data in a database to retrieve the necessary information from it.
  • DDL: CREATEALTER TABLEDROPTRUNCATE, and ADD COLUMN
  • DML: UPDATEDELETE, and INSERT
  • DCL: GRANT and REVOKE
  • TCL: COMMITSET TRANSACTIONROLLBACK, and SAVEPOINT
  • DQL: – SELECT
                +---------------------+
                |   SQL Commands      |
                +----------+----------+
                           |
                           v
                +----------+----------+
                |     DDL (Data      |
                | Definition Language)|
                +----------+----------+
                           |
                 +---------+---------+
                 |                   |
            +----+----+        +-----+-----+
            | CREATE  |        |  ALTER   |
            | TABLE   |        |  TABLE   |
            +----+----+        +-----+-----+
                 |                   |
                 v                   v
        +--------+---------+   +-----+-------+
        |                  |   |             |
 +------|   DROP TABLE     |   |  MODIFY     |
 |      |                  |   |  TABLE      |
 |      +------------------+   +-------------+
 |                                        |
 |                                        v
 |                               +--------+--------+
 |                               |                  |
 +-------------------------------|  RENAME TABLE    |
                                 |                  |
                                 +------------------+

                +----------+----------+
                |    DML (Data       |
                | Manipulation Language)|
                +----------+----------+
                           |
                 +---------+---------+
                 |                   |
            +----+----+        +-----+-----+
            | INSERT  |        |  UPDATE   |
            | INTO    |        |  TABLE    |
            +----+----+        +-----+-----+
                 |                   |
                 v                   v
        +--------+---------+   +-----+-------+
        |                  |   |             |
 +------|   DELETE FROM    |   |  MERGE INTO  |
 |      |                  |   |    TABLE    |
 |      +------------------+   +-------------+
 |                                        |
 |                                        v
 |                               +--------+--------+
 |                               |                  |
 +-------------------------------|  TRUNCATE TABLE  |
                                 |                  |
                                 +------------------+

                +----------+----------+
                |    DCL (Data       |
                | Control Language)   |
                +----------+----------+
                           |
                 +---------+---------+
                 |                   |
            +----+----+        +-----+-----+
            | GRANT  |        |  REVOKE   |
            |        |        |  PRIVILEGES|
            +----+----+        +-----+-----+
                                       |
                                       v
                              +--------+--------+
                              |                  |
                              |  SET TRANSACTION|
                              |                  |
                              +------------------+

Written by HintsToday Team

Related Posts

Database Structures, Types of Keys

Learn about tables, fields (or attributes), records, keys and table relationships. What is database structure? A database structure is the blueprint that defines how data is arranged ,organized, stored, accessed, and managed within a database. It's the underlying...

read more

SQL Data Types(Numeric, String & Date)- Default Values

SQL (Structured Query Language) supports various data types to represent different kinds of data. These data types define the format and constraints of the data stored in each column of a table. Here are some common SQL data types: Numeric Types: INT: Integer type,...

read more

Get the latest news

Subscribe to our Newsletter

0 Comments

Submit a Comment

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