I have two tables,
Websites. I also have an "associative" table called
Partners_Websites that retains the relationships "between" the rows of the tables
Websites. In the
Partners table, there are rows that I want to relate to all rows in the
Websites table (even rows that can be added in the future).
Let's say I have P1, P2, P3 and W1, W2 and W3:
I want P1 related to W1 and W3
P2 related to W1 and W2
P3 related to all Websites
Partners_Websites table will look like:
P1, W1 P1, W3 P2, W1 P2, W2 P3, W1 P3, W2 P3, W3
If I add W4, I will need to add a new row in the
Partners_Websites table to relate it to P3. How can I define "P3 is related to all Ws" without requiring the
Partners_Websites table? I was thinking in adding a "flag" in
Partners (that is, a boolean column named
is_related_to_all) but I think it looks wrong (I may end up with hundreds of
is_related_to_all = false).
Is there any way of doing this using relationships?