Thursday 14 May 2015

What is DDL, DML, DCL and TCL Commands in SQl server ?

Here First I explain breifly What is SQl, then types of Commands and then Details of each type.

SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database. According to ANSI (American National Standards Institute), it is the standard language for relational database management systems. SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database. Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc. Although most database systems use SQL, most of them also have their own additional proprietary extensions that are usually only used on their system. However, the standard SQL commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish almost everything that one needs to do with a database. This tutorial will provide you with the instruction on the basics of each of these commands as well as allow you to put them to practice using the SQL Interpreter.

SQL Commands:

SQL commands are instructions used to communicate with the database to perform specific task that work with data. SQL commands can be used not only for searching the database but also to perform various other functions like, for example, you can create tables, add data to tables, or modify data, drop the table, set permissions for users. SQL commands are grouped into four major categories depending on their functionality:

Types of Commands:-

1.  DDL
2.  DML.
3.  TCL.
4.  DCL.

Data Definition Language (DDL) :- Data definition language (DDL) commands enable you to perform the following tasks:


  1.         Create, alter, truncate and drop schema objects
  2.         Grant and revoke privileges and roles
  3.         Add comments to the data dictionary


The CREATE, ALTER, and DROP commands require exclusive access to the object being acted upon. For example, an ALTER TABLE command fails if another user has an open transaction on the specified table.

Data Manipulation Language (DML): - These SQL commands are used for storing, retrieving, modifying, and deleting data. These commands are below


  1.  SELECT, 
  2.  INSERT,
  3.  UPDATE, and
  4.  DELETE.


Transaction Control Language (TCL) :-  Transaction control commands manage changes made by DML commands. These SQL commands are used for managing changes affecting the data. These commands are below

  1. COMMIT,
  2.  ROLLBACK, and 
  3. SAVEPOINT.


Data Control Language (DCL): -  It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it. These SQL commands are used for providing security to database objects. These commands are below

  1. GRANT and
  2.  REVOKE. 



No comments:

Post a Comment