Beginners DDL, DML, DCL and TCL Commands in SQL with Examples
SQL commands are divided into four subgroups, DDL, DML, DCL, and TCL. As a beginner I will briefly describe about these categories of SQL that I've learned recently.
N:B: This is from my personal note, please let me know if you have any feedbacks
DDL(Data Definition Language)
DDL denotes Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.
CREATE - for creating a database and its objects like (table, index, views, store procedure, function, and triggers). ALTER - alters the structure of the existing database. DROP - delete objects from the database. TRUNCATE - removing 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.
DML(Data Manipulation Language)
DML is short form of Data Manipulation Language which deals with data manipulation and describes the most common SQL statements such as SELECT, INSERT, UPDATE, DELETE, etc. and it is used to store, modify, retrieve, delete and update data in a database.
SELECT - retrieve data from a database. INSERT - insert data into a table. UPDATE - updates existing data within a table. DELETE - Delete all records from a database table.
DCL(Data Control Language)
DCL is short form of Data Control Language which includes commands such as GRANT and mostly concerned with rights, permissions and other controls of the database system.
GRANT - Used to provide any user access privileges or other priviliges for the database. REVOKE - Used to take back permissions from any user.
TCL(Transaction Control Language)
TCL is short name of Transaction Control Language which deals with a transaction within a database.
COMMIT - command is used to permanently save any transaction into the database. SAVEPOINT - command is used to temporarily save a transaction so that you can rollback to that point whenever required. ROLLBACK - This command restores the database to last commited state. It is also used with SAVEPOINT command to jump to a savepoint in an ongoing transaction.
Using this commands we can easily learn about the SQL .