SQL Interview Question: Primary Key vs Unique Key vs Foreign Key
Short answer: a primary key uniquely identifies each row and can't be NULL (one per table). A unique key also enforces uniqueness but a table can have many, and they may allow NULLs. A foreign key links a column to a key in another table and enforces that the...