SQL for Data Analytics · Modeling relationships
Modeling relationships
In a many-to-many relationship, a row on each side can connect to many rows on the other. A student takes many classes, and a class has many students. This unit is about how a database stores that kind of relationship, with a joining table, and how to query through it. You also draw entity relationship diagrams of your own.
The lessons:
- Many-to-many (20 min). What a many-to-many relationship is, the joining table that stores it, querying through that table, and table aliases.
- Drawing diagrams (35 min). Writing the CREATE TABLE statements for a diagram, and drawing diagrams of your own.
- Composite primary keys (15 min). When a joining table's two foreign keys can be its primary key, and when it needs an ID of its own.
When you've finished the lessons, do the Practice. It's worth fifteen points. This is what you turn in on Canvas.