UNIQUE Constraint

Also known as · UNIQUE

A constraint that stops two rows sharing a value in the column (or column combination). NULLs are normally still allowed.

sql
email VARCHAR(100) UNIQUE

When to use

In PP 01 UNIQUE and NOT NULL are the constraints in the official answer, and PP 04 uses it to show that two separate UNIQUE constraints would wrongly stop an author writing two books, where one constraint over the pair is needed.

See PP 01.

Appears in