Tuesday, September 22, 2015

Define DDL , DML and DCL.

Solution:-
         DDL (Data Definition Language) is used by the database designers and programmers to specify the content and structure of the table. Commands are:- CREATE , DROP , RENAME etc.

Example:- 
 CREATE DATABASE campus ;
CREATE TABLE student ( Roll_no int , Fname varchar(25) , Lname varchar(25) , Address varchar(25) ) ;

            DML (Data Manipulation Language) is related with manipulations of record such as retrieval , sorting , display & deletion of record of data. Commands are:- SELECT , UPDATE , INSERT etc.
Example:- 
 INSERT INTO student values(1001 , “NP”, “Rijal”, “KTM” ) ;
SELECT * FROM student ;
UPDATE student SET Address=”VKT” WHERE Roll_no=1001 ;

           DCL (Data Control Language) is used in controlling the transaction that happened in the database. Example, Rollback commit are DCL and we can use commit statement to finalize the transaction in the database. Once the transaction is committed it cannot be rolled back.
Example are:- GRANT , REVOKE etc.
Example:-
GRANT SELECT ON student TO netra;
REVOKE SELECT ON student to netra;