Skip to main content

Command Palette

Search for a command to run...

Understanding SQL Commands: DDL vs. DML

Published
2 min read
Understanding SQL Commands: DDL vs. DML
G

I am a highly skilled software engineer based in Abuja, Nigeria, specialisng in cutting-edge technologies including JavaScript, TypeScript, Node.js, React-Native, PHP, ASP.NET Core, and machine learning. With a fervent passion for innovation and a talent for problem-solving, I excel in crafting sophisticated and high-performance web applications.

My expertise lies in seamlessly blending creativity with technical prowess to deliver unparalleled user experiences. I pride myself on my ability to develop intelligent solutions that not only meet but exceed expectations. With a keen eye for detail and a dedication to excellence, I am committed to transforming abstract concepts into impactful and transformative digital solutions.

Let’s embark on a journey of innovation together. Explore my portfolio to witness the fusion of technology and creativity, and let’s discuss how I can elevate your digital presence and bring your vision to life.

Introduction

When working with relational databases, understanding the distinction between Data Definition Language (DDL) and Data Manipulation Language (DML) commands is crucial. DDL and DML are two categories of SQL commands that serve distinct purposes in managing and manipulating a database. In this blog post, we'll delve into each category and provide an overview of the commands within them.

Data Definition Language (DDL) Commands:

  1. CREATE:

    • Used for creating new database objects, such as tables, views, indexes, and databases.
  2. ALTER:

    • Modifies the structure of existing database objects, including adding or dropping columns in a table.
  3. DROP:

    • Deletes existing database objects, such as tables, views, or databases.
  4. TRUNCATE:

    • Removes all records from a table while retaining the table structure.
  5. COMMENT:

    • Adds comments or descriptions to database objects for documentation purposes.

Data Manipulation Language (DML) Commands:

  1. SELECT:

    • Retrieves data from one or more tables based on specified criteria.
  2. INSERT:

    • Adds new records into a table.
  3. UPDATE:

    • Modifies existing records in a table based on specified conditions.
  4. DELETE:

    • Removes records from a table based on specified conditions.
  5. MERGE (in some database systems):

    • Combines multiple operations (INSERT, UPDATE, DELETE) into a single, atomic statement.

Conclusion:

In summary, DDL commands are focused on defining and managing the structure of the database, creating, altering, or dropping objects. On the other hand, DML commands are concerned with manipulating the data stored in the database—retrieving, inserting, updating, or deleting records from tables. A comprehensive understanding of both DDL and DML commands is essential for effective database management and querying.

24 views