Close the loophole on a column that's never actually null
customers.email is declared as a nullable TEXT column, but every process that writes to this table already requires an email — none of the existing rows have one missing. The nullability is just an oversight from when the table was first created.
Add a NOT NULL constraint to customers.email so the database enforces what's already true of the data.
Schema
| id | INT |
| TEXT | |
| name | TEXT |
Example input
Why
ALTER TABLE ... ALTER COLUMN ... SET NOT NULL is a scan-and-check operation: Postgres reads every existing row to confirm none of them actually has a null in that column before it agrees to add the restriction. If even one row did, the whole statement rolls back and nothing changes — the constraint is all-or-nothing, never applied partially. This is the same guarantee a PRIMARY KEY gives you implicitly (a primary key column is always NOT NULL), just spelled out explicitly for a column that isn't a key.
Stuck? Ask the coach for a nudge that won't give the answer away, or reveal the reference solution and a short walkthrough of why it works.