Question: Below is the answer to a previous question I had, but I do not understand why truncate is a DDL command, but Delete is a
Below is the answer to a previous question I had, but I do not understand why truncate is a DDL command, but Delete is a DML command. Can you please explain with an example of each?
Hi, 1.
Data Definition Language(DDL) is the one which deals with database schemas and descriptions, of how the data should reside in the database. examples:
CREATE - to create database and its objects
ALTER - alters the structure of the existing objects in database
DROP - delete objects from the database
TRUNCATE - remove all records from a table
COMMENT - add comments to the data dictionary
RENAME - rename an object
2.
Data Manipulation Language(DML) is the one which deals with data manipulation,it is used to store, modify, retrieve, delete and update data in a database
SELECT - retrieve data from a table in database
INSERT - insert data into a table
UPDATE - updates data of a table
DELETE - Delete all records from a table
3.
Data Control Language(DCL) is the one which includes commands that are used to grant rights, permissions and other controls of the database .
GRANT - allow users access privileges to database
REVOKE - withdraw users access privileges
4.
Transaction Control Language(TCL) are the ones which deals with a transaction within a database
COMMIT - commits a Transaction
ROLLBACK - rollback a transaction
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
