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

  • In DDL we use
    DDL
    CREATE – Creates objects in the database
    ALTER – Alters objects of the database
    DROP – Deletes objects of the database
    TRUNCATE – Deletes all records from a table and resets table identity to initial value.

    DML
    SELECT – Retrieves data from a table
    INSERT – Inserts data into a table
    UPDATE – Updates existing data into a table
    DELETE – Deletes all records from a table

    DCL
    GRANT – Gives user’s access privileges to database
    REVOKE – Withdraws user’s access privileges to database given with the GRANT command

    TCL
    COMMIT – Saves work done in transactions
    ROLLBACK – Restores database to original state since the last COMMIT command in transactions
    SAVE TRANSACTION – Sets a savepoint within a transaction

    Reply
  • what is the difference between drop,delete,truncate commands? and please explain clearly what is the operation of DCL command ?

    Reply
  • gud work….!!
    can u plz upload some sql queries …
    like those which would help in interviews…

    Reply
  • hi…..sir
    could u tell me totally how many commands are there in sql server

    Regards

    madhusudan

    Reply
  • hi shirisha

    Difference between Drop,Delete and truncate is

    Drop- Drop command will delete the entire row also the structure.it is DDL command.

    Delete- Delete command only remove the data from the table.it is DML command. You can Rollback.

    Truncate- truncate will delete the contents not the strucure. it is DDL command.In truncate you cant rollback.it removes record permanently.you cant use where clause in Truncate.

    Reply
  • Hello Mr.dave.

    Question : The __________ component is used to administer permissions on the databases and database objects.

    Please tell me about above Question

    Reply
  • what is the major difference between drop an delete.
    who devolped SQL and ORACLE
    what is BAN

    Reply
    • Have you googled/binged?

      Reply
    • Pushkaraj shinde
      June 6, 2011 5:09 pm

      Difference between Drop and Delete are as follows:

      1) DROP is a DDL statement in order to drop the table and database:

      i) SYNTAX:

      DROP TABLE TABLE_NAME;
      DROP DATABASE DATABASE_NAME;

      EXAMPLE:

      DROP TABLE EMP_DEPARTMENT;
      DROP DATABASE EMPLOYEE

      ii) When we used DROP TABLE it deletes the entire table data with a structure(column names also).

      iii) When we used DROP DATABASE it deletes the entire DATABASE containing a number of tables, functions, stored procedures …………………n .

      2) DELETE:

      i) Delete command is used to delete the data within a table and not for any database.

      ii) When we use Delete command it only deletes the data within a table but keeps the structure of table as it is.

      SYNTAX: DELETE TABLE_NAME

      EXAMPLE:

      DELETE EMPLOYEE;

      (That is it kees the table name as it is)

      I hope , after reading this you would be satisfied.

      Reply
  • Bivash Kumar Singh
    July 13, 2011 5:56 pm

    hello, i am Bivash Kumar Singh. i am complite Gniit from kolkata, but i am not so confedent in sql so what should i do

    Reply
  • Hello Pinal,

    Could you please tell me how to view the pseudo columns in SQL Server 2005

    Reply
  • how can we copy a old database in new database

    Reply
  • thanks madhivanan can you tell me about how use it

    Reply
    • Backup source db

      Backup database db_name to disk=’your ptah’

      Restore in target db

      restore database db_name from disk=’your ptah’

      Reply
  • hii sir,
    can i know how to use grant and revoke in sql server 2005 with syntax
    pls

    Reply
  • hi sir,
    can i know how to rollback deleted data in sql server 2005 with syntax
    thank you

    Reply
  • hi guys.. i have one doubt?
    tcl means transcational control language..?
    dtl means data transcation language?
    what is the difference between these two?
    in tcl they told only committ and rollback.. they are not mentioned the svae point in the tcl.. but dtl they mentioned…
    what is the exact difference between thes two?

    Reply
  • santhosh kum ar
    August 7, 2011 5:42 pm

    Hi sir i hav a one doubt DDL command which times is used pls tell me sir.Santhosh

    Reply
  • very niceee definatoin of DDL DML DCL TCL…. BUT i have a ques in my mind what is DQL…..plzzz tell meeee……..

    Reply
  • Sir, I want merge two table Without relationship using pseudo-column how??

    … Please help me…

    Reply
  • DDL (Data Definition Language): CREATE, ALTER, DROP
    DML(Data Manipulation Language) : INSERT, UPDATE, DELETE
    DCL (Data Control Language) : GRANT, REVOKE
    TCL (Transactional Control Language) : COMMIT, SAVE POINT, ROLLBACK
    DQL (Data Query Language) : SELECT

    Reply
  • hello every one this is EKRAR and i want your help

    actually i want to create a whole database for practice but i dont have any idea that how many table should be in that and what should be the name of thats table and what type of data should be in that

    so any one is here who can help my
    i really needy for your suggestion

    and i am waiting for your suggestion at
    [email removed]

    Reply
  • where from i can get Adventureworks database

    Reply

Leave a Reply