Add a new column and fill existing rows with a default.

highlighted = computed this step

Add a column with a default

The first change adds a new column. Existing rows receive the same default value.

add default column\text{add default column}

Show the new shape

After 1 step, the table has 3 columns.

columns=3\text{columns}=3

Schema-change examples are tiny finite table transforms; SQL dialects, online migration algorithms, locks, performance, ORMs, compliance, and operational runbooks are out of scope.

Add column default: beforeidname1Ada2Bo ordered schema stepsstepop1add_column_default step snapshotsstepopcolumnsrows0start[id, name]21add_column_default[id, name, age]2 final tableidnameage1Ada02Bo0 changed columnskindcolumnsadded[age]removed[]kept[id, name] changed rowsrowbeforeafter0[1, Ada][1, Ada, 0]1[2, Bo][2, Bo, 0] safety factsfactvaluestepCount1rowCount2columnCount3changedRowCount2

Read the new column

The new column appears in every row because the default was applied to the whole tiny table.

default fills rows\text{default fills rows}

Summary

This is a finite table transform, not a SQL dialect claim.

shape changes\text{shape changes}