Briefle words · Code & architecture
Composite primary key
A unique identifier for a row made from two or more columns together.
Say it to an AI
Postgres migration for course enrollments, normalized to 3NF: separate students and courses tables, and an enrollments join table with foreign keys to both and a composite primary key (student_id, course_id). No student or course details duplicated in enrollments.
How an expert would brief the stronger version of “Enrollments schema”.
See it
Try it as a puzzle →The first database migration for an online course platform, run in a Postgres client.
Why: B's PRIMARY KEY (student_id, course_id) means a student can be enrolled in each course only once.
Related words
Room 5 · APIs & data
Learn “Composite primary key” in a five-minute lesson