Data Definition Language (DDL)

Lesson 2 of 20

Build a school database from nothing: CREATE the tables, ALTER them when plans change, DROP them when they must go.

The big picture

Tables are built, changed, torn down

DDL is the construction crew of SQL: it shapes the containers before any data moves in.

CREATE

Builds a new table: a name plus a column list, each column with a type and rules.

ALTER

Changes a table that already exists — add a column, rename one, attach a rule.

DROP

Deletes the table and every row inside it. There is no undo button.

DDL vs DML

DDL shapes the container (the table); DML moves the cargo (the rows). DML gets its own lesson next.