---
description: What is DDL? Data Definition Language helps you to define the database structure or schema. DDL commands help you to create the structure of the database and the other database objects. Its commands a
title: Difference Between DDL and DML in DBMS
image: https://www.guru99.com/images/ddl-and-dml.png
---

[Skip to content](#main)

## Key Differences between DDL vs DML

- Data Definition Language (DDL) helps you to define the database structure or schema, while Data Manipulation Language (DML command) allows you to manage the data stored in the database.
- The DDL command is used to create the database schema, while the DML command is used to populate and manipulate the database
- Comparing DDL vs DML, DDL statements affect the whole table, whereas DML commands only affect one or more rows.
- In DDL, SQL Statement can’t be rollbacked, while in DML, SQL Statement can be rollbacked.
- DDL is a declarative method, while DML is an imperative method.
- Important DDL commands are: 1) CREATE, 2) ALTER, 3) DROP, 4) TRUNCATE, etc., while important DML commands are: 1) INSERT, 2) UPDATE, 3) DELETE, 4) MERGE, etc.

[![Difference Between DDL and DML in DBMS]()](https://www.guru99.com/images/ddl-and-dml.png)

*Difference Between DDL and DML in DBMS*

Here, I have analyzed the difference between DDL and DML and will comprehensively evaluate their pros and cons.

## What is DDL?

Data Definition Language helps you to define the database structure or schema. DDL commands help you to create the structure of the database and the other database objects. Its commands are auto-committed so, the changes are saved in the database permanently. The full form of DDL is Data Definition Language.

## DDL Commands

Five types of DDL commands are:

### CREATE

CREATE statements is used to define the database structure schema:

**Syntax:**

```
CREATE TABLE TABLE_NAME (COLUMN_NAME DATATYPES[,....]); 

```

**For example**:

```
Create database university;
Create table students;
Create view for_students;

```

### DROP

Drops commands remove tables and databases from [RDBMS](https://www.guru99.com/relational-data-model-dbms.html).

**Syntax:**

```
DROP TABLE ;  

```

**For example:**

```
Drop object_type object_name;
Drop database university;
Drop table student;

```

### ALTER

Alters command allows you to alter the structure of the [database](https://www.guru99.com/introduction-to-database-sql.html).

**Syntax:**

To add a new column in the table

```
ALTER TABLE table_name ADD column_name COLUMN-definition;  

```

To modify an existing column in the table:

```
ALTER TABLE MODIFY(COLUMN DEFINITION....); 

```

**For example:**

```
Alter table guru99 add subject varchar;

```

### TRUNCATE

This command is used to delete all the rows from the table and free the space containing the table.

**Syntax:**

```
TRUNCATE TABLE table_name;  

```

**Example:**

```
TRUNCATE table students;

```

## DDL Command Example

### CREATE

**Syntax:**

```
CREATE TABLE tableName
( 
  column_1 datatype [ NULL | NOT NULL ],
  column_2 datatype [ NULL | NOT NULL ],
  ...
);

```

Here,

- The parameter tableName denotes the name of the table that you are going to create.
- The parameters column\_1, column\_2… denote the columns to be added to the table.
- A column should be specified as either NULL or NOT NULL. If you don’t specify, [SQL Server](https://www.guru99.com/sql-server-introduction.html) will take NULL as the default

**Example:**

```
CREATE TABLE Students
(
Student_ID Int,
Student_Name Varchar(10)
)

```

### ALTER

**Syntax:**

```
Alter TABLE <Table name> ADD Column1 datatype, Column2 datatype;

```

**Example:**

```
ALTER TABLE University.Students_Name ADD Course_Duration VARCHAR(20);

```

### DROP

**Syntax:**

```
DROP TABLE <tableName>;

```

The parameter tableName is the name of the table that is to be deleted.

**Example:**

```
DROP TABLE COURSE_NAMES;

```

## Why we Use DDL commands?

Here, I will explain why we prefer the DDL method:

- Allows you to store shared data
- Data independence improved integrity
- Allows multiple users
- Improved security efficient data access

**Don't Miss:**

- [Entity Relationship (ER) Diagram Model with DBMS Example](https://www.guru99.com/er-diagram-tutorial-dbms.html)
- [What is DBMS (Database Management System)?](https://www.guru99.com/what-is-dbms.html)
- [Hashing in DBMS: Static and Dynamic Hashing Techniques](https://www.guru99.com/hashing-in-dbms.html)
- [12 BEST Database Management Software (2026)](https://www.guru99.com/best-database-management-software.html)

## What is DML?

DML commands it to allow you to manage the data stored in the database, although DML commands are not auto-committed. Moreover, they are not permanent. So, It is possible to roll back the operation. The full form of DML is Data Manipulation Language.

## DML Commands

I’d like to highlight some important DML commands:

- INSERT
- UPDATE
- DELETE

### INSERT

This is a statement that is a SQL query. This command is used to insert data into the row of a table.

**Syntax:**

```
INSERT INTO TABLE_NAME  (col1, col2, col3,.... col N)  
VALUES (value1, value2, value3, .... valueN);  
Or 
INSERT INTO TABLE_NAME    
VALUES (value1, value2, value3, .... valueN);    

```

**For example:**

```
INSERT INTO students (RollNo, FIrstName, LastName) VALUES ('60', 'Tom', 'Erichsen');

```

### UPDATE

This command is used to update or modify the value of a column in the table.

**Syntax:**

```
UPDATE table_name SET [column_name1= value1,...column_nameN = valueN] [WHERE CONDITION]   

```

**For example:**

```
UPDATE students    
SET FirstName = 'Jhon', LastName=' Wick' 
WHERE StudID = 3;

```

### DELETE

This command is used to remove one or more rows from a table.

**Syntax:**

```
DELETE FROM table_name [WHERE condition];

```

**For example:**

```
DELETE FROM students 
WHERE FirstName = 'Jhon';

```

## DML Command Example

### INSERT

In [PL/SQL](https://www.guru99.com/pl-sql-tutorials.html), we can insert the data into any table using the [SQL](https://www.guru99.com/sql-commands-dbms-query.html) command INSERT INTO. This command will take the table name, table column, and column values as the input and insert the value in the base table.

The INSERT command can also take the values directly from another table using ‘SELECT’ statement rather than giving the values for each column. Through ‘SELECT’ statement, we can insert as many rows as the base table contains.

**Syntax:**

```
BEGIN
  INSERT INTO <table_name>(<column1 >,<column2>,...<column_n>)
     VALUES(<valuel><value2>,...:<value_n>);
END;

```

The above Syntax shows the INSERT INTO command. The table name and values are mandatory fields, whereas column names are not mandatory if the insert statements have values for all the columns of the table.

The keyword ‘VALUES’ is mandatory if the values are given separately, as shown above.

**Syntax:**

```
BEGIN
  INSERT INTO <table_name>(<columnl>,<column2>,...,<column_n>)
     SELECT <columnl>,<column2>,.. <column_n> FROM <table_name2>;
END;

```

The above Syntax shows the INSERT INTO command that takes the values directly from the \<table\_name2> using the SELECT command.

The keyword ‘VALUES’ should not be present in this case, as the values are not given separately.

### DELETE

Below is the Syntax to delete table

**Syntax:**

```
DROP TABLE <TableName>;

```

The parameter TableName is the name of the table that is to be deleted.

**Example:**

```
DROP TABLE COURSE_NAMES;

```

### SELECT

To view data in SQL Server, we use the SELECT statement.

**Syntax:**

```
SELECT expression
FROM tableName
[WHERE condition];

```

**Example:**

```
SELECT * FROM Course;

```

## Why we Use DML Commands?

Here, drawing from our collective experience, are the benefits of DML:

- The DML statements allow you to modify the data stored in a database.
- Users can specify what data is needed.
- DML offers many different flavors and capabilities between database vendors.
- It offers an efficient human interaction with the system.

## Difference Between DDL and DML in DBMS

Let me explain the main difference between DDL and DML commands in [DBMS](https://www.guru99.com/dbms-tutorial.html):

[![Key Differences between DDL vs DML]()](https://www.guru99.com/images/2/060520_1030_DifferenceB1.png)

*DDL vs DML*

| Comparison Basis | DDL | DML |
| --- | --- | --- |
| Basic | Data Definition Language (DDL) helps you to define the database structure or schema. | Data Manipulation Language (DML command) allows you to manage the data stored in the database. |
| Use | DDL command is used to create the database schema. | DML command is used to populate and manipulate database |
| Categorization | DDL is not classified further. | DML is classified as Procedural and Non and Procedural DMLs. |
| Command Uses | The commonly used commands under the DDL language are:<ul><li>CREATE</li><li>ALTER</li><li>DROP</li><li>TRUNCATE</li><li>COMMENT</li><li>RENAME</li></ul> | The commonly used commands under DML language are:<ul><li>INSERT</li><li>UPDATE</li><li>DELETE</li><li>MERGE</li><li>CALL</li></ul> |
| Defines | It defines the column of the table. | It adds or updates the row of the table |
| Effect | DDL statements affect the whole table. | DML effects one or more rows. |
| Rollback | SQL Statement can’t be rollback | SQL Statement can be a rollback |

## How to Choose Between a DDL and a DML

We observe that while DDL is used to define the structure of the database, DML is all about the data within, each serving critical roles.

#### Summarize this post with:

ChatGPTPerplexityGrokGoogle AI

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.**

##### Sign up for the newsletter

Subscribe for Free

You have successfully subscribed.  
Please check your inbox.

![AI-Newsletter]() Chosen by over **350,000+** professionals

[Scroll to topScroll to top](#wrapper) Scroll to top

×

Toggle Menu Close

Search for:

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/ddl-and-dml.png","url":"https://www.guru99.com/images/ddl-and-dml.png","width":"775","height":"250","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/difference-between-ddl-and-dml.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/dbms","name":"DBMS"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/difference-between-ddl-and-dml.html","name":"Difference Between DDL and DML in DBMS"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/difference-between-ddl-and-dml.html#webpage","url":"https://www.guru99.com/difference-between-ddl-and-dml.html","name":"Difference Between DDL and DML in DBMS","dateModified":"2024-06-28T18:35:35+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/ddl-and-dml.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/difference-between-ddl-and-dml.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/fiona","name":"Fiona Brown","description":"I'm Fiona brown, a Full Stack Developer with over a decade of experience, sharing practical guides on robust and scalable application development.","url":"https://www.guru99.com/author/fiona","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/fiona-brown-author.png","url":"https://www.guru99.com/images/fiona-brown-author.png","caption":"Fiona Brown","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"@type":"NewsArticle","headline":"Difference Between DDL and DML in DBMS","keywords":"dbms, sql","dateModified":"2024-06-28T18:35:35+05:30","articleSection":"DBMS","author":{"@id":"https://www.guru99.com/author/fiona","name":"Fiona Brown"},"publisher":{"@id":"https://www.guru99.com/#organization"},"description":"What is DDL? Data Definition Language helps you to define the database structure or schema. DDL commands help you to create the structure of the database and the other database objects. Its commands a","copyrightYear":"2024","copyrightHolder":{"@id":"https://www.guru99.com/#organization"},"name":"Difference Between DDL and DML in DBMS","@id":"https://www.guru99.com/difference-between-ddl-and-dml.html#richSnippet","isPartOf":{"@id":"https://www.guru99.com/difference-between-ddl-and-dml.html#webpage"},"image":{"@id":"https://www.guru99.com/images/ddl-and-dml.png"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/difference-between-ddl-and-dml.html#webpage"}}]}
```
