Explain it in 60 seconds
Primary key vs foreign key
Data Engineering · SQL · Beginner
What is the difference between a primary key and a foreign key?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- A primary key uniquely identifies each row and can't be NULL.
- A table has one primary key, which can be made of several columns.
- A foreign key in one table refers to the primary key of another table.
- Foreign keys enforce referential integrity in OLTP databases.
- Many cloud warehouses don't enforce these constraints, so you test them instead.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.