Learn VisualLearn DB Visual
JA

Choose a Stable Identifier

A candidate key is a smallest set of attributes that uniquely identifies an entity, and the chosen candidate becomes the primary key. A natural key has meaning outside the database, while a surrogate key exists only to identify a row. The store uses stable integer ids for its main entities and the pair order_id plus product_id for OrderItem.

Why use customers.id as the primary key while keeping email UNIQUE?