Primary Key

noun

say it: “PRY-mair-ee KEE” /ˈpraɪmɛri kiː/

A column, or columns, whose value is unique for every row and identifies it, such as ProductID.

What is Primary Key in a relational database?

Primary Key — The chosen candidate key that uniquely identifies every row and cannot contain NULL.

CREATE TABLE customer (
    customer_id INTEGER PRIMARY KEY,
    email CHARACTER VARYING(255) NOT NULL,
    status CHARACTER VARYING(20) DEFAULT 'active'
);

In a sentence

  • “ProductID is the primary key, so no two products can share an id.”

Level: Novice · More Database terms at this level

Updated