Jump to content

Archived

This topic is now archived and is closed to further replies.

mgm_03

many to many

Recommended Posts

My application has many categories and subcategories with which I need to match with businesses.

 

After giving it alot of thought, I don\'t see how to avoid creating many tables, each being a map of many-to-many relationships.

 

From my understanding, many2many has disadvantages but I\'d like to know why. Can anyone enlighten me so I don\'t regret this strategy.

 

Using \"1 to many\" will require between 100 and 200 tables so, it doesn\'t appeat to be an elegant solution :?

Share this post


Link to post
Share on other sites

How do you implement one-to-one, one-to-many and many-to-many relationships while designing tables?

 

One-to-One relationship can be implemented as a single table and rarely as two tables with primary and foreign key relationships.One-to-Many relationships are implemented by splitting the data into two tables with primary key and foreign key relationships.Many-to-Many relationships are implemented using a junction table with the keys from both the tables forming the composite primary key of the junction table.

 

It will be a good idea to read up a database designing fundamentals text book.

Share this post


Link to post
Share on other sites

Thanks for trying to help me with this. I have read the books about database design and normalizing, etc. I understand it all but one book made a point to say that you should avoid making tables that have many2many relationships. I know how they\'re made and how to use them but before I implement it I just want to know if down the road, after insertions, updates, deletes, etc....will this approach turn out to be a nightmare....OR, should I force every table into a one-to-many structure.

 

sorry if I wasn\'t being clear on that.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.