Modelling a Blog: Users Posts Comments
Draw an ER diagram, identify entities and relationships, and translate them into a normalised SQL schema.
The Domain
A simple blog: users write posts, other users comment on posts. Let's turn that into a schema.
Entities
Three core nouns:
- User — id, email, name
- Post — id, author, title, body, published timestamp
- Comment — id, author, post it's on, body
All lessons in this course
- Modelling a Blog: Users Posts Comments
- Choosing Keys and Types
- Indexes for Common Queries
- Seeding the Database with Test Data