DDL and DML are different type of SQL queries in MySQL. The full form of DDL and DML is Data Definition language and Data Manipulation Language.

DDL – Data Definition Language:

This are the SQL statements which are most related to Database creating/changing structure. The List of DDL statements are as follow:

  • CREATE – statement is used to create database and other objects
  • ALTER – statement is used to change the database structure
  • DROP – statement is used to delete the database and other objects
  • TRUNCATE – statement  to remove all the records from a table, including all spaces allocated for the records are removed
  • COMMENT – add comments to the data dictionary
  • RENAME – rename is used to rename the objects

DML – Data Manipulation Language:

These are the SQL statements which are related to Database manipulation like fetching, adding, updating data to table. The List of DML statements are as follow:

  • SELECT – statement is used to retrieve/fetch data from the a database
  • INSERT – statement used to insert data into a table
  • UPDATE – statement used to  updates existing data within a table
  • DELETE – deletes all records from a table, the space for the records remain
  • CALL – call a PL/SQL or Java subprogram

DCL – Data Control Language

These are the SQL statements which are related to control the user access to the Database. The List of DCL statements are as follow:

  • GRANT – statement  allows specified privileges to database
  • REVOKE – withdraw access privileges given with the GRANT command

TCL – Transaction Control Language

There are the SQL statements which are related to control transactions. The List of TCL statements are as follow:

  • COMMIT – save 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

 

Thank you for reading the article. Please comment if you have any confusion.