Databases & Data Storage

Primary Key

Definition

A primary key is a specific choice of a minimal set of attributes (columns) that uniquely specify a tuple (row) in a relation (table). In simple terms, it's a unique identifier for each record.

Why It Matters

Primary keys are essential for relational databases. They guarantee that each row is unique and provide a reliable way to reference specific records from other tables (via foreign keys).

Contextual Example

In a `Users` table, the `UserID` column would be the primary key. It is a unique number for each user. No two users can have the same `UserID`.

Common Misunderstandings

  • A primary key cannot contain NULL values.
  • A primary key can be a single column (like `UserID`) or a combination of multiple columns (a "composite key").

Related Terms

Last Updated: December 19, 2025