SQL SERVER – What is – DML, DDL, DCL and TCL – Introduction and Examples

DML

DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database.

Examples: SELECT, UPDATE, INSERT statements

DDL

DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database.

Examples: CREATE, ALTER, DROP statements

DCL

DCL is abbreviation of Data Control Language. It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it.

Examples: GRANT, REVOKE statements

TCL

TCL is abbreviation of Transactional Control Language. It is used to manage different transactions occurring within a database.

Examples: COMMIT, ROLLBACK statements

Reference : Pinal Dave (https://blog.sqlauthority.com)

Database
Previous Post
SQL SERVER – Time Out Due to Executing DELETE on Large RecordSet
Next Post
SQLAuthroity News – Microsoft SQL Server 2000 Assessment Configuration Pack

Related Posts

170 Comments. Leave new

  • Dave!

    DDL: CREATE, ALTER, DROP
    DML: SELECT, INSERT, UPDATE, DELETE

    Sorry! :)

    Reply
  • ok

    Reply
  • DDL : CREATE, ALTER, DROP
    DML : INSERT, UPDATE, DELETE
    DCL : GRANT, REVOKE
    TCL : COMMIT, SAVE POINT, ROLLBACK
    DQL : SELECT

    Reply
    • what is the meaning of DQL?

      Reply
      • DQL: Data Query Language

      • hai vikram
        this is mahi
        i dont know dql explan please

      • dql stands data query language which is used to extract the required data from the table or database

      • good answer

      • It is not DQL vikram… IT IS DRL Friend .

        SELECT is a DRL statement.

        DRL ::

        DRL means Data Retrieval Language. This will be used for the retrieval of the data from the database.
        In order to see the data present in the database, we will use DRL statement. We have only one DRL
        statement.

        SELECT is the only DRL statement in SQL

      • Anjali Naidu
        March 4, 2014 9:02 pm

        if there is dml to select they why again drl?

      • Both are same DRL or DQL

      • hi ..that select statement under dql or dml…

      • Pushkaraj shinde
        June 6, 2011 4:53 pm

        SQL statements are divided into three types, DQL is the one of three types.

        DQL is the abbreviation of “Data query language”.

        In order to query(fetch data) this uses “SELECT” COMMAND

        Syntax:
        Select * from table_name;

        Select column_name1, [column_name2]….[n]
        from table_name;

        Example:
        Select * from Employee;

        Select emp_name, emp_salary
        from Employee;

      • data query language i think

      • Documentum Query Language, its used to Query.

    • many guys told dql is not important…
      the select is also included in the dml.. is it true?

      Reply
      • Nick Verhaeghe
        August 9, 2012 10:38 pm

        Yes, because you can SELECT [columns] INTO [table] FROM [table] you can manipulate data with it. CRUD commands are DML.

      • Yes if we use select * into table name then it is DML/DDL because it’s not only creating a table but also inserting data as well, any miss please correct

      • Sorry one point is it is your wish how you use select statement as a dml or ddl statement or simple query purpose,,

      • Then Y its not part of DDL?

    • geetz is perfect DQL is select but above mention that select is including in DML

      Reply
    • truncate,rename and modify operation are there in ddl

      Reply
    • select command come with under DRL (or) DRS
      DRS Stands for data retrieval statement (or)

      Reply
  • thanks a lot for this blog

    Reply
  • Hi Mr.Dave,
    I am so impressed with ur resume, and I wish u all success,
    I am new to MS SQL server and I am looking for an example that can show me how to use DDL statements of MS SQL server for how to create a table (for example):
    Table name= Sales
    Sales ( CustomerNo, ItemNo, Price, quant, TotalAmount )
    Primary key ( CustomerNo, ItemNo)
    Foriegne Key (CustomerNo)
    Constraint ( quant in sales table must be = < item balance in inventory table ).

    I would highly appreciate ur kind info

    Many thanks and regards

    Adnan

    Reply
  • What about DECLARE and SET? I read posts about not mixing DDL and DML due to stored procedure recompiles, but while these seem like structure and therefore DDL, variables are so temporary that I’m not sure.

    Thanks!

    Reply
  • Hi Pinal
    I would like to know about the commant invoke and how to use this command in sqlserver with one example.
    Thanks&Regards,
    Shiva

    Reply
  • Farid ud din masood
    July 30, 2008 4:54 pm

    This artical is useful to know about the sql language types.

    I know to use the DDL and DML but want to know TCL please do post some easy code.

    Reply
  • Dear Sir

    Hope, will be better and safe and sound, when i watched and read your website completely,it is too dramatic , mavel and i have no words in skull to praise you.

    Please sir i have learnt the DML, and other but do post a simple code of TSQL or TCL

    Respectfully yours
    Bakht Riaz

    Reply
  • Dear Dave,
    what is the difference between SQL and DML??

    Reply
    • Krishna Prasad
      May 18, 2011 4:20 pm

      This is Krishna prasad

      Sql is a query language that is used to interact with database …
      in that we have sub parts
      ddl
      dml
      tcl
      dcl
      so ddl is the part in sql

      ddl (data definition or description language)
      has some commands
      Create,
      alter
      Drop

      Reply
  • Dear Dave,

    Can you pls elucidate the difference between MS-SQL and ORACLE database?

    I heard that Oracle has more features for “Customization” and “Security” from my fellow associates

    Thanks

    Jetty

    Reply
  • Will Marcouiller
    October 10, 2008 9:14 pm

    To answer to post reply 11, the difference between SQL and DML.

    First, I guess you got to know that SQL acronym stands for Structured Query Language.

    Second, DML means Data Manipulating Language.

    There is no difference between those two as DML is a statement category of SQL. In other words, DML is part of SQL.

    This is only because SQL is somehow divided into categories, and those categories includes DDL (Data Definition Language), DML (Data Manipulating Language), DCL (Data Control Language) and TCL (Transaction Control Language). All these categories forms SQL (Structured Query Language).

    I hope this helps.

    Thanks!

    Reply
  • I am trying to convert a SQL Server database to DB2 and was wondering if there is any way to easily get the DDL for the database or transfer data. I expect the data extract/transform/load process will require some manual intervention, but getting the DDL seems like it should be built in to SQL Server functionality.

    Reply
  • I got the following question in an assignment and was unable to get it all right. It reads “Explain six components of SQL”

    I’ll highly appreciate ur response

    Reply
    • Hassan Farooqi
      August 22, 2012 8:38 pm

      1. One SQL-agent responsible for causing the execution of SQL statements. It is usually an application program that calls one or more externally-invoked procedures in an SQL-client Module.

      2. One SQL-implementation; a database management system (DBMS) that executes SQL statements. Your SQL-agent considers your DBMS to have two components: (a) one SQL-client, to which the SQL-agent is bound, and (b) one or more SQL-servers to manage your SQL-data. (SQL-data consists of the descriptions of all the SQL Objects, plus all the data values you can access with your DBMS.) The SQL-client is the part of your DBMS that establishes connections to the SQL-servers; it maintains a diagnostics area and other state data that relate to the interactions between the DBMS and the SQL-agent. Each SQL- server has three responsibilities: (a) it manages the SQL-session taking place over the SQL-Connection between itself and the SQL-client, (b) it executes SQL statements received from the SQL-client, receiving and sending data as required, and (c) it maintains the state of the SQL-session, including the and certain session defaults. The method of communication between the SQL-client and the SQL-server(s) is implementation-defined, but the Standard does specify how an SQL- agent will communicate with your DBMS (see SQL Binding Styles).

      3. Zero or more SQL-client Modules, each containing zero or more externally-invoked procedures. SQL-client Modules are programming modules — exactly one is associated with an SQL-agent at any time.

      4. Zero or more s. An SQL , or authorization identifier, represents a user of SQL-data.

      5. Zero or more Catalogs.

      6. Zero or more sites (e.g., Base tables) that contain SQL-data.

      Reply
  • Wagner Bianchi
    January 3, 2009 2:12 am

    You forget DELETE statement…

    ;-)

    Reply
  • I notice there are a lot of basic questions here that I could help with. Where do the answers to these questions get posted? Does the author reply to you all individually?

    Reply
  • SQL statement is strecture queruy language

    Reply
  • hi

    i would like to know about the commit and rollback in detail. tanx

    Reply
  • this is good feed back

    Reply
  • hi mr dave i’m newer
    want to ask u

    how about where, distinct, like,
    is it dml or ddl or dcl or tcl ?

    thank’s lot

    Reply
    • Hi Rizal,

      plz go thru the below

      select distinct(emp_id) from the department
      where first_name like ‘ra%’

      It contains all keywords which u want to clear.

      Thanks

      Reply

Leave a Reply