DDL, DML & DCL Commands in SQL

Mohammed Imtiyaz Nov 26, 2014

Data Definition Language (DDL):

DDL statements are used to define the database structure or schema. Some examples are as follows:

CREATE Create objects in the database
ALTER Alters the structure of the database
DROP Delete objects from the database
TRUNCATE Remove all records from a table, including all spaces allocated for the records are removed.
COMMENT Add comments to the data dictionary
RENAME Rename an object

Data Manipulation Language (DML):

DML statements are used for managing data within schema objects. Some exmples are as follows:

SELECT Retrieve data from the database
INSERT Inser data into a table
UPDATE Updates existing data within a table
DELETE Deletes all records from a table.
MERGE UPSERT operation (Inert or Update)
CALL Call a PL/SQL program
EXPLAIN PLAN Explain access path to data
LOCK TABLE Control concurrency

Data Control Language (DCL):

Some examples are as follows:

GRANT GRANT Gives user's access privileges to database
REVOKE Withdraw access privileges given with the GRANT command

Transaction Control (TCL)

TCL statements are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions.

COMMIT Saves work done
SAVEPOINT Identify a point in a transaction to which you can later roll back
ROLLBACK Restore database to original since the last COMMIT
SET TRANSACTION Change transaction options like isolation level and what rollback segment to use.