Your Success, Our Mission!
6000+ Careers Transformed.
DDL stands for Data Definition Language and refers to SQL commands used to create, modify, and delete database structures such as tables, indexes, and views. DML stands for Data Manipulation Language and refers to SQL commands used to insert, update, and delete data within a database. Now, let’s learn about the DDL and DML commands in depth.
DDL (Data Definition Language) is a type of SQL command used to define data structures and modify data. It creates, alters, and deletes database objects such as tables, views, indexes, and users. Examples of DDL statements include CREATE, ALTER, DROP and TRUNCATE.
CREATE TABLE Employees ( EmployeeID INT, FirstName VARCHAR(255), LastName VARCHAR(255), Department VARCHAR(255) ); ALTER TABLE Employees ADD Salary INT; DROP TABLE Employees;
This code creates a new employee table containing four columns: EmployeeID, FirstName, LastName, and Department. It then adds an additional column, Salary, to the table. Finally, it drops the Employees table from the database.
DML (Data Manipulation Language) is a type of SQL command used to manipulate data in a database. It inserts, updates, and deletes data from a database table. Examples of DML statements include INSERT, UPDATE, and DELETE.
INSERT INTO Employees (EmployeeID, FirstName, LastName, Department) VALUES (1, 'John', 'Smith', 'IT'); UPDATE Employees SET Salary = 50000 WHERE EmployeeID = 1; SELECT * FROM Employees; DELETE FROM Employees WHERE EmployeeID = 1;
This code inserts a new row into the Employees table with the values of 1, 'John', 'Smith', and 'IT' for the respective columns. It then updates the Salary column for the row with an EmployeeID of 1 to 50000. It then selects all of the rows from the Employees table and finally deletes the row with an EmployeeID of 1.
Explore the DDL vs DML commands in SQL in the below table. Understand how DDL commands shape database structures, while DML commands manipulate data within the database.
| DDL | DML |
|---|---|
| Used to define database objects like tables, indexes, views, etc. | Used to manipulate data within the database. |
| Examples of DDL statements include CREATE, ALTER, and DROP. | Examples of DML statements include SELECT, INSERT, UPDATE, and DELETE. |
| Changes made using DDL affect the structure of the database. | Changes made using DML affect the data stored in the database. |
| DDL statements are not transactional, meaning they cannot be rolled back. | DML statements are transactional, meaning they can be rolled back if necessary. |
| DDL statements are usually executed by a database administrator. | DML statements are executed by application developers or end-users. |
| DDL statements are typically used during the design and setup phase of a database. | DML statements are used during normal operation of a database. |
| Examples of DDL statements: CREATE TABLE, DROP TABLE, ALTER TABLE, CREATE INDEX, etc. | Examples of DML statements: SELECT, INSERT, UPDATE, DELETE, etc. |
1. What is DDL and DML?
Answer: a. Data Definition Language and Data Manipulation Language
2. What is the purpose of DDL?
Answer: a. To define data types and structures
3. What is the purpose of DML?
Answer: b. To manipulate stored data
4. What are the components of DDL?
Answer:a. CREATE, ALTER, DROP
Top Tutorials

Python
Python is a popular and versatile programming language used for a wide variety of tasks, including web development, data analysis, artificial intelligence, and more.

Data Science
Learn Data Science for free with our data science tutorial. Explore essential skills, tools, and techniques to master Data Science and kickstart your career

Applied Statistics
Master the basics of statistics with our applied statistics tutorial. Learn applied statistics techniques and concepts to enhance your data analysis skills.
All Courses (6)
Master's Degree (2)
Fellowship (2)
Certifications (2)