Thursday, May 15, 2008

DML, DDL, DCL and TCL-Statements in SQL SERVER

DML
DML is abbreviation of Data Manipulation Language. It is used to store (Insert), modify, delete, insert and update data in database.
Examples DML: INSERT, UPDATE and DELETE statements
Where,
UPDATE - updates data in the database
DELETE - deletes data from the database
INSERT INTO - inserts new data into the database

DQL
DQL is abbreviation of Data Query Language. Used to retrieve the records / data from database.
Many people include this category into DML Statements.
Example: SELECT statement
WHERE
SELECT - extracts data from the database

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
Where,
CREATE TABLE - creates new database table
ALTER TABLE - alters or changes the database table
DROP TABLE - deletes the database table
CREATE INDEX - creates an index or used as a search key
DROP INDEX - deletes an index

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
Where,
GRANT – gives access privileges to users for database
REVOKE – withdraws access privileges to users for database

TCL
TCL is abbreviation of Transactional Control Language. It is used to manage different transactions occurring within a database.
Examples: COMMIT, SAVE POINT, ROLLBACK statements
Where,
COMMIT – saves the work done
SAVEPOINT – saves the work done up to some point. Used with Rollback.
ROLLBACK - restore the database to original since the last COMMIT

No comments: