1
SQLBeginner#keys
A primary key uniquely identifies a row and is NOT NULL (one per table). A unique key also enforces uniqueness but allows a NULL and can appear many times. A foreign key references another table's key and enforces referential integrity.
CREATE TABLE users ( id INT PRIMARY KEY, email VARCHAR(100) UNIQUE, dept_id INT REFERENCES departments(id) );