SQL Alternate Key

An Alternate Key is a candidate key that is not selected as the Primary Key.

In simple words:
👉 When there are multiple candidate keys, one is chosen as the Primary Key, and the remaining candidate keys become Alternate Keys.

Key Characteristics
   • Uniquely identifies a record
   • Cannot contain duplicate values
   • Usually implemented using UNIQUE constraint
   • Candidate key but not chosen as primary key

SQL Example

CREATE TABLE Students (
    Student_ID INT PRIMARY KEY,
    Email VARCHAR(100) UNIQUE,
    Phone VARCHAR(15) UNIQUE,
    Name VARCHAR(50)
);

Explanation:
Student_ID → Primary Key
Email → Alternate Key
Phone → Alternate Key

The UNIQUE constraint ensures that alternate keys remain unique.

Simple Definition
👉 Alternate Key = Candidate Key – Primary Key
It is a unique column that could have been the primary key but was not chosen.


Topics