Sunday, 16 July 2017

What is DDL, DML, DCL and TCL?

DDL
A data definition language or data description language (DDL) is syntax similar to a computer programming language for defining data structures, especially database schemas.
CREATE
To create database and its objects like (table, index, views, store procedure, function and triggers)
ALTER
Alters the structure of the existing database and its objects
DROP
Delete objects from the database
TRUNCATE
Remove all records from a table, including all spaces allocated for the records
RENAME
Renames an object
COMMENT
Add comments to the data dictionary
DML
DML stands for Data Manipulation Language to retrieve and manipulate data in a relational database, and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE etc, and it is used to store, modify, retrieve, delete and update data in database.
Data manipulation language comprises the SQL data change statements, which modify stored data but not the schema.
Data manipulation languages have their functional capability organized by the initial word in a statement, which is almost always a verb. In the case of SQL, these verbs are:
SELECT
Retrieve data from the database.
INSERT
Insert data into a table
UPDATE
Updates existing data within a table
DELETE
Delete all records from a database table
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
DCL stands for Data Control Language used to control access to data stored in a database.
GRANT
Providing  user with set of roles to access database
REVOKE
Withdraw user’s access privileges already given
TCL
TCL is short name of Transaction Control Language which deals with transaction within a database. TCL statements are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions.
COMMIT
Saves the work done
ROLLBACK
Restore database to original since the last COMMIT
SAVEPOINT
Identify a point in a transaction to which you can later roll back
SET TRANSACTION
Change transaction options like isolation level and what rollback segment to use

No comments:

Post a Comment