DDL is the construction crew of SQL: it shapes the containers before any data moves in.
1 CREATE
Builds a new table: a name plus a column list, each column with a type and rules.
2 ALTER
Changes a table that already exists — add a column, rename one, attach a rule.
3 DROP
Deletes the table and every row inside it. There is no undo button.
4 DDL vs DML
DDL shapes the container (the table); DML moves the cargo (the rows). DML gets its own lesson next.
Tables are built, changed, torn down
CREATE1Builds a new table: a name plus a column list, each column with a type and rules. ALTER2Changes a table that already exists — add a column, rename one, attach a rule. DROP3Deletes the table and every row inside it. There is no undo button. DDL vs DML4DDL shapes the container (the table); DML moves the cargo (the rows). DML gets its own lesson next. 4 building blocks make up Tables are built, changed, torn down
Press play through schema.sql, then switch to the evolution.sql tab to watch ALTER and DROP work.
The client opens schema.sql. The database is completely empty — three tables are about to be born.
Memory
tables in database= (none)
Console
output appears as the program runs…
Ask three quick questions and the right statement picks itself.
process decision input / output start / end A short script for the club database. What does the client print, line by line?
Your predicted output — one line per console line
Hint: DROP TABLE removes the table completely — what does a SELECT aimed at a table that no longer exists return?
Click a keyword, then click its job to lock the pair.
5 conceptsTap a card to expand ?CREATE TABLEdrops into place
?ALTER TABLEdrops into place
?DROP TABLEdrops into place
?PRIMARY KEYdrops into place
?VARCHAR(50)drops into place
01CREATE TABLE builds the container; the column list is the blueprint.
02ALTER TABLE changes the shape later — data already inside is kept.
03DROP TABLE is irreversible: table and data vanish together.
04DDL statements end with a semicolon and report messages like "Table created."
05Types and constraints are declared at CREATE time and enforced forever after.