Primary Key
A Primary Key uniquely identifies each record in a table.
Example:
Products
|
ProductID |
Product |
|
P101 |
Laptop |
|
P102 |
Mouse |
|
P103 |
Monitor |
ProductID is the unique identifier.
Foreign Key
A Foreign Key stores the identifier used to connect another table.
Sales
|
OrderID |
ProductID |
Sales |
|
O101 |
P101 |
120000 |
|
O102 |
P102 |
5000 |
Here:
- Products[ProductID] → Primary Key
- Sales[ProductID] → Foreign Key
Important
A primary key should normally contain unique values, while a foreign key can contain repeated values.
Practice
Identify the primary and foreign keys in the Business Data Model.