Skip to content

9618 · 8.3

Data Definition Language (DDL) and Data Manipulation Language (DML)

DDL is like the architect's blueprint, defining the structure of the database (tables, columns). DML is like the daily activity within the building, adding, changing, and retrieving the information stored inside.

Need to know

What you need to know

  • **CREATE**: Used to build new database objects. The most common is `CREATE TABLE`.
  • **ALTER**: Used to modify the structure of an existing object. For example, `ALTER TABLE` can add a new column.
  • **DROP**: Used to permanently delete an entire database object. For example, `DROP TABLE` removes a table and all its data.

Explanation

Database Blueprints vs. Day-to-Day Operations

  1. DDL defines structure: CREATE, ALTER, DROP tables.
  2. DML queries data: SELECT … FROM … WHERE …
  3. DML modifies data: INSERT, UPDATE, DELETE.
  4. PRIMARY KEY, FOREIGN KEY, NOT NULL enforce integrity.