Composite Key

A composite key is a key consisting of two or more attributes that together uniquely identify a tuple. Neither attribute alone is unique — only the combination is. Most commonly seen as the Primary Key of a Junction Table.

CREATE TABLE enrollments (
    student_id INT REFERENCES students(id),
    course_id INT REFERENCES courses(id),
    grade VARCHAR(2),
    PRIMARY KEY (student_id, course_id)  -- Composite key
);

Relevance to Normalization

Composite keys are central to 2NF: a relation with a composite primary key violates 2NF if any non-key attribute depends on only part of the key (a partial functional dependency). The fix is to decompose the table.