SQLMentor // glossary

DDL (Data Definition Language)

DDL is the subset of SQL that defines and changes database structure — CREATE, ALTER, DROP, and TRUNCATE. In most databases DDL statements auto-commit.

DDL manages the schema (tables, indexes, views), as opposed to DML which manages the data inside it. Because CREATE and ALTER usually commit automatically, they can't simply be rolled back like a normal transaction.

This auto-commit is why TRUNCATE (DDL) cannot be undone while DELETE (DML) can — a classic interview distinction.

Example

CREATE TABLE projects (project_id INT PRIMARY KEY, name VARCHAR2(100));
ALTER  TABLE projects ADD (deadline DATE);
DROP   TABLE projects;