# ERD
# Entities
Entities are the rows attributes are the columns in the database.
# Cardinality
# PK
Primary Key is a unique attribute that identifies every record in a certain table.
You need 1 primary key per entity.
Rules
- Unique
- Never changing
- Never Null
# FK
Primary Key that is referenced in another entity.
There can be multiple FKs in one entity.
# Composite PK
When you combine keys to make a PK
Two show composite PK, you put two PK in front of the keys. But this does not mean it has two primary keys.
Rules
- Use the fewest number of attributes possible
- Don't use attributes that are apt to change
# Why not use shipment ID?
You could. Some people hate composite PKs. Depends on the scenario.
# Bridge Tables
# Why not just create many to many relationship?
If you create such relationship, you will be missing a lot of information such as 'when' the order was made. That's when the bridge table comes in.