Records and Relationships
This lesson practices domain modeling and when to use a one-to-many or a many-to-many relationship.
Topics
- domain modeling
- database design
What are the associations?
- Cities and Neighborhoods
- Courses and Students
- Photographers and Photos
- Bands and Venues
- Contractors and Clients
- States and Senators
- Groups and Members
One-to-Many or Many-to-Many?
When you’re deciding, ask yourself:
- Can one x have many y?
- Can one y have many x?
The answer is usually: it depends on what you’re building.
Justify it.
If One-to-Many, which table gets the foreign key column?
If Many-to-Many, what’s a good name for the join table?
Next Up
HTML