Difference Between DDL and DML
DDL | DML |
---|---|
It stands for Data Definition Language. | It stands for Data Manipulation Language. |
It is used to create database schema and can be used to define some constraints as well. | It is used to add, retrieve, or update the data. |
It basically defines the column (Attributes) of the table. | It adds or updates the row of the table. These rows are called tuples. |
It doesn’t have any further classification. | It is further classified into Procedural and Non-Procedural DML. |
Basic commands present in DDL are CREATE, DROP, RENAME, ALTER, etc. | BASIC commands present in DML are UPDATE, INSERT, MERGE etc. |
DDL does not use WHERE clause in its statement. | While DML uses WHERE clause in its statement. |
DDL is used to define the structure of a database. | DML is used to manipulate the data within the database. |
DDL is used to create and modify database objects like tables, indexes, views, and constraints. | DML is used to perform operations on the data within those database objects. |
DDL statements are typically executed less frequently than DML statement | DML statements are frequently executed to manipulate and query data. |
DDL statements are typically executed by database administrators. | DML statements are typically executed by application developers or end-users. |
DDL statements are not used to manipulate data directly. | DML statements are used to manipulate data directly. |
The database’s contents are not altered by DDL commands. | DML commands alter the database’s contents. |
Examples of DDL commands: CREATE TABLE, ALTER TABLE, DROP TABLE, TRUNCATE TABLE, and RENAME TABLE. | Examples of DML commands: SELECT, INSERT, UPDATE, DELETE, and MERGE. |
Difference Between DDL and DML in DBMS
DDL is a Data Definition Language that is used to define data structures. For example: creating a table, and altering a table are instructions in SQL. DML is a Data Manipulation Language that is used to manipulate data itself. For example: insert, update, and delete are instructions in SQL.