I have n
number of tables that are related on a many-to-many basis. I want to know how to represent such a model without creating an intermediary table for each relationship as that would result in some large number of tables. For this purpose assume that n
is sufficiently large to not want to create tables.
For example I may have three tables where n is 3:
Parking_Lot
Car
Person
A car can park in many parking lots and a parking lot will have many cars. A person may drive many cars and a car can have many drivers. A parking lot has many people and many people can be in a parking lot. (the people could be employees or they could just physically be in the parking lot. Please don't over analyze this example, as it is only an example.)
To model this you would have 3 tables (Lot, Car, Person
) and three relationship tables.
Say you add a 4th table of food. Food can be eaten in many parking lots, in many cars and by many people. This takes 4 tables + 6 = 10 tables.
How do you model such a relationship without creating a large number of intermediate tables?
I'm more interested in the concept, but I primarily use c# so if there's a neat may to accomplish this in .net I'm all ears.