💻 Learn Coding

05. Relational Database Keys in SQL

Database keys enforce entity integrity, prevent duplicate records, and establish relational links between SQL tables. Explore each key type in detail below:


🔑 Sub-Topics in Database Keys

01. Primary Key

Master unique row identification via PRIMARY KEY constraints and B-Tree indexing.

02. Foreign Key

Learn relational table linking via FOREIGN KEY and cascading referential actions (`ON DELETE CASCADE`).

03. Candidate Key

Understand minimal super keys eligible to become Primary Keys using UNIQUE NOT NULL.

04. Super Key

Explore attribute sets uniquely identifying rows and their relation to Candidate Keys.

05. Alternate Key

Study secondary candidate keys enforced with UNIQUE constraints.

06. Composite Key

Design multi-column primary keys for junction/bridge tables in Many-to-Many relationships.

07. Surrogate Key

Implement synthetic, system-generated IDs (`AUTO_INCREMENT`, `SERIAL`, `UUID`, `IDENTITY`).


🧭 Navigation

← Back to SQL Course Index | Start Lesson 01: Primary Key →