Difference between DDL and DML in DBMS
Prerequisite – DDL, DQL, DML, DCL, and TCL Commands DDL is Data Definition Language that is used to define data structures. For example: create table, alter table are instructions in SQL. DML is Data Manipulation Language that is used to manipulate data itself. For example: insert, update, and delete are instructions in SQL.
The 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 add or updates the row of the table. These rows are called tuple. |
It doesn’t have any further classification. | It is further classified into Procedural and Non-Procedural DML. |
Basic command present in DDL are CREATE, DROP, RENAME, ALTER etc. | BASIC command 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 statements. | 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. |
DDL statements do not change the contents of the database. | DML statements change the contents of the database. |
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. |
Please Login to comment...