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 !!!

Subscribe via RSS feed

The following two tabs change content below.
Anil Kumar
IT Blogger Tips focus on Blogging Tips, SEO Tips, Social Media, SQL Tips, PL/SQL Tips, Oracle DBA, Linux/Unix, Latest Technology, How Tos and Technical Solutions. You can find us on Facebook | Twitter |
Find on Google+