Wednesday, May 12, 2010

Introduction to DDL, DML, DCL and TCL

The Different categories into which the SQL statements fall are : 

1. Data Retrieval Statement :  Data Retrieval Statement can be used to retrieve the data from the database Objects. 

Example :

SELECT       -  To retrieve the data from the database

2. Data Definition Language (DDL)  :  Data Definition Language statements are used to define the database structure or schema.

Examples :

CREATE      - To create an object in the database
ALTER        - To alter the structure of the database object
DROP          - To drop an objects from the database
TRUNCATE  - To remove all records from a table at a time and      removes all spaces allocated for those records
RENAME      - To rename an object

3. Data Manipulation Language (DML) :  Data Manipulation Language statements are used for maniplulate or manage the data within the schema objects

Examples :

INSERT      -  To insert new records into a table
UPDATE     -  To update existing data within a table
DELETE      -  To delete all the records from a table

4. Data Control Language (DCL) :  Data Control Language statements are used to create roles, permissions, and referential integrity

Examples :

GRANT       - To give access privileges to the user in a   database
REVOKE      - To remove the access privileges given with the GRANT command

5. Transaction Control Language (TCL) : Transaction Control Language statements are used to manage different transactions occurring within a database.

Examples:

COMMIT      -  TO save the work done
SAVEPOINT -  To identify a point in a transaction up to which we can roll back later
ROLLBACK   -  To restore database to original position since the last COMMIT

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.