Primary key vs foreign key
A primary key uniquely identifies a row in its own table, while a foreign key points to a related row in another table.
- Primary key is table identity
- Foreign key creates relationship
- Helps enforce referential integrity
Primary key vs foreign key