Data Definition Language (DDL) and Data Manipulation Language (DML) together forms a Database Language. The basic difference between DDL and DML is that DDL (Data Definition Language) is used to Specify the database schema database structure.
On the other hand, DML (Data Manipulation Language) is used to access, modify or retrieve the data from the database. Let us discuss the differences between DDL and DML, with the help of comparison chart shown below.
Content: DDL Vs DML in DBMS
Comparison Chart
Basis for Comparison | DDL | DML |
---|---|---|
Basic | DDL is used to create the database schema. | DML is used to populate and manipulate database |
Full Form | Data Definition Language | Data Manipulation Language |
Classification | DDL is not classified further. | DML is further classified as Procedural and Non-Procedural DMLs. |
Commands | CREATE, ALTER, DROP, TRUNCATE AND COMMENT and RENAME, etc. | SELECT, INSERT, UPDATE, DELETE, MERGE, CALL, etc. |
Definition of DDL (Data Definition Language)
DDL stands for Data Definition Language. The Data Definition Language defines the database structure or database schema. DDL also defines additional properties of the data defined in the database, as the domain of the attributes. The Data Definition Language also provide the facility to specify some constraints that would maintain the data consistency.
Let us discuss some commands of DDL:
- CREATE is command used to create a new Database or Table.
- ALTER command is used to alter the content in the Table.
- DROP is used to delete some content in the database or table.
- TRUNCATE is used to delete all the content from the table.
- RENAME is used to rename the content in the database.
One can notice that DDL only defines the columns (attributes) of the Table. Like other programming languages, DDL also accept the command and produce output that is stored in the data dictionary (metadata).
Definition of DML (Data Manipulation Language)
DML stands for Data Manipulation Language. The schema (Table) created by DDL (Data Definition Language) is populated or filled using Data Manipulation Language. DDL fill the rows of the table, and each row is called Tuple. Using DML, you can insert, modify, delete and retrieve the information from the Table.
Procedural DMLs and Declarative DMLs are two types DML. Where Procedural DMLs describes, what data is to be retrieved and also how to get that data. On other hands, Declarative DMLs only describes what data is to be retrieved. It doesn’t describe how to get that data. Declarative DMLs are easier as the user has only to specify what data is required.
The commands used in DML are as follow:
- SELECT used to retrieve the data from the Table.
- INSERT used to push the data in the Table.
- UPDATE used to reform the data in the Table.
- DELETE used to delete the data from the Table.
If we talk about SQL, the DML part of SQL is non-Procedural i.e. Declarative DML.
Key Differences Between DDL and DML in DBMS
- The basic difference between DDL and DML is that DDL (Data Definition Language) is used to define the schema or the structure of Database which means it is used to create the Table (Relation) and the DML (Data Manipulation Language) is used to access, or modify the schema or Table created by DDL
- DML is classified in two types Procedural and Declarative DMLs whereas the DDL is not classified further.
- CREATE, ALTER, DROP, TRUNCATE, COMMENT and RENAME, etc. are the commands of DDL. On the other hand, SELECT, INSERT, UPDATE, DELETE, MERGE, CALL, etc. are the commands of DML.
Conclusion
For forming a database language both DDL and DML is necessary. As they both will be required to form and access the database.
Amit Singh says
This is knowledgeable.
DAVID says
THANKS TO THE PUBLISHER …TOMORROW IS MY ICT FINAL EXAM OF 10TH IS THERE THIS INFORMATION HELPED ME TO LEARN AND UNDERSTAND
REGARDS…
Tithi says
Thanks! It helped me a lot. 👍
Shivaam says
Thanks, it helped me in the practical exam.
regards.
nischal says
Thank you
Nik says
Nice solution
Alku_cute_deyyam says
This helped me a lot!!! THANK YOU SO MUCH..!!!!
Harsh Vadchhak says
Thanks!! It’s an easy solution to understand.👍
Nikhil says
Thank you! very clear explanation about DDL and DML.
MANU says
THANKS, GUYS ……..HELPED ME A LOT !!!!!!!
P.S TOMORROW IS MY EXAM XD
Rose Mae says
Hi, this really helped me on my assistant! God bless you
Rob says
What about CREATE OR REPLACE PACKAGE BODY? Is that DML or DDL? The reason I’m asking is because I need to provide a script to the DBA for code changes in the production environment (developers don’t have access to prod), and I need to know if I have to put a COMMIT statement at the end. I believe COMMIT is only needed after DML statements, not DDL statements. The PL/SQL code in the package body is stored in the database (I assume there’s a table for it). But on the other hand, the CREATE OR REPLACE PACKAGE BODY statement isn’t listed as a DDL statement. So it kinda falls in the middle somewhere. It’s a bit DML-ish and a bit DDL-ish.