Problem Statement
Which statement correctly contrasts a PRIMARY KEY with a UNIQUE constraint?
Explanation
A primary key uniquely identifies each row and forbids NULL by definition. It is also the default target for foreign keys.
UNIQUE enforces distinct values but often allows one or more NULLs depending on the DBMS. You can define multiple UNIQUE constraints per table.
Code Solution
SolutionRead Only
CREATE TABLE users ( id BIGINT PRIMARY KEY, email TEXT UNIQUE );
Practice Sets
This question appears in the following practice sets:
