Difference Between DDL, DML and DCL Commands
This is the most important question asked in an interview. How to differentiate DDL, DML and DCL commands?
What are DDL commands?
DDL – Data Definition Language commands are used to define the structure or schema of a database. There are many DDL commands like below:
CREATE: This command is used to create database objects like (TABLE, VIEW and INDEX etc.)
ALTER: This command alters the structure of database.
DROP: Removes objects from database.
TRUNCATE: To remove all rows from a Table. (Can’t be rolled back)
COMMENT: To add comments to the data dictionary.
RENAME: To rename an Object.
DML – Data Manipulation Language commands are used for managing or manipulating data within schema objects.
SELECT: To retrieves data from the database and objects.
INSERT: To insert records into a Table.
UPDATE: To update existing data within a Table.
DELETE: To remove records from a Table.
MERGE: To create UPSERT operation (Insert or Update)
CALL: To call a PL/SQL or Java Program
EXPLAIN PLAN: It explains access path to data.
LOCK TABLE: To control concurrency
DCL – Data Control Language commands are used to control the database objects.
GRANT: To give users access privileges to database.
REVOKE: Withdrawal access privileges given by the GRANT command.
Transaction Control – These commands manage the changes made by DML commands.
COMMIT: To make changes permanent to database.
ROLLBACK: To restore database to its original state since the last COMMIT occurred.
SAVEPOINT: You can identify a point in a transaction to which you can later on Rollback.
SET TRANSACTION: This option is used to change transaction options like isolation level etc.
I hope you understood the basic difference between DDL, DML and DCL commands.
Get Free Blogging Tips & Technology updates in your Email !!!
Latest posts by Anil Verma (see all)
- BlueHost Affiliate Program – Earn $65 Per Referral - August 2, 2015
- WP Engine Affiliate Program – Earn $200 Per Referral - August 1, 2015
- How to fill out BlueHost Affiliate Tax form for Non-US Residents - June 20, 2015