Monday, February 8, 2016

DML,DDL,DCL and TCL commands

DDL (Data Definition Language)

DDL statements deals with definition of the database structure or schema.
CREATE - used to create objects in the database
ALTER - used to alter the structure of the database
DROP - to drop objects from the database
TRUNCATE - delets all records from the table along with all the spaces allocated to those records
COMMENT - used to add comments to the data dictionary
RENAME - to rename an object

DML(Data Manipulation Language)

DML statements deals with data management within the db schema objects.
SELECT - to retrieve data from the a database
INSERT - to insert data into a table
UPDATE - to update existing data within the table
DELETE - deletes records from a table, the space for the records remain.Also can be used to delete records with condition based.
MERGE - UPSERT operation (insert or update)
CALL - call a PL/SQL or Java subprogram
EXPLAIN PLAN - explain access path to data
LOCK TABLE - control concurrency

DCL(Data Control Language)

DCL statements are used to control privilege in database.
GRANT - gives user access privileges to database
REVOKE - take back access privileges given with the GRANT command

TCL(Transaction Control Language)

TCL commands are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions.
COMMIT - save work done -- NOTE : INSERT,UPDATE and DELETE requires commit.
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

No comments:

Post a Comment