Add a primary key to an unkeyed orders table
This orders table was created without a primary key — every column is nullable and nothing stops a duplicate id from being inserted. id is meant to uniquely identify a row and is never null in the data that's already there.
Add a PRIMARY KEY constraint on orders.id. Don't create a new table — alter the existing one.
Schema
| id | INT |
| customer_id | INT |
| amount | NUMERIC |
Example input
Why
ALTER TABLE ... ADD CONSTRAINT ... PRIMARY KEY (id) does two things in one statement: it enforces NOT NULL on id (a primary key can never be null) and builds a unique index on it, which is how the constraint is actually enforced under the hood — the same index you'd get from CREATE UNIQUE INDEX. If any existing row already had a null or duplicate id, this statement would fail immediately rather than silently ignoring the bad rows, which is why it's safe to run against live data.
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.