I Help You
Databases

Surrogate Key

A surrogate key is an artificial identifier with no business meaning, generated by the database or the application to be a table's primary key. Typical surrogate keys are auto-incrementing integers and UUIDs.

The opposite is a natural key, built from real-world data such as a PAN number, email or product code. Surrogate keys never change, are compact and keep joins simple, while natural keys can change or turn out not to be unique. Many designs use a surrogate primary key and keep the natural key as a unique (alternate) key.

ExampleSQL
CREATE TABLE customers (
  id   BIGINT AUTO_INCREMENT PRIMARY KEY,  -- surrogate key
  pan  CHAR(10) NOT NULL UNIQUE,           -- natural key
  name VARCHAR(100)
);