Databases & SQL
Foreign Key
A column that links one table's row to another table's primary key.
Reviewed by the RadarTrek editorial team · June 2026
A foreign key is a column that stores the primary key value of a row in a different table, creating a connection between the two. For example, orders.user_id stores the id of the user who placed that order — this is exactly the relationship a JOIN uses to combine the two tables.
Why it matters
- —Foreign keys are how relational databases connect data across tables instead of duplicating it.
- —They're the basis for every JOIN — without them, related tables couldn't be linked together.
- —Good schema design uses foreign keys to keep data consistent and avoid duplication.
Where to learn this
🎓
What Is a Database?
SQL for Builders course
This is the exact lesson that covers this term in depth — with examples, diagrams, and a hands-on exercise.