Briefle words · Code & architecture
Foreign key
A column that points to a row in another table, and that the database guarantees actually exists.
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 student_id INT REFERENCES students(id) can't point to a student who doesn't exist; A just repeats 'Mia Chen' as text.
Related words
Room 5 · APIs & data
Learn “Foreign key” in a five-minute lesson