...
/Solution: Create an Intersection Table
Solution: Create an Intersection Table
Let's devise a solution for Jaywalking by creating an intersection table.
We'll cover the following...
Instead of storing the account_id in the Products table, we can store it in a separate table, so each individual value of that attribute occupies a separate row. This new table Contacts implements a many-to-many relationship between Products and Accounts:
When the table has foreign keys referencing two tables, it’s called an
Let’s see how using an intersection table resolves all the problems we saw in the previous lesson.
Querying products by account and the other way around
In order ...