Jump to content


Photo

many to many


  • Please log in to reply
2 replies to this topic

#1 mgm_03

mgm_03
  • Members
  • PipPipPip
  • Advanced Member
  • 49 posts
  • LocationFort Worth, TX

Posted 20 June 2003 - 02:20 PM

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 :?
Guru?...in my dreams!
Sorry Everybody

----------------------

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 21 June 2003 - 05:49 AM

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.
Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#3 mgm_03

mgm_03
  • Members
  • PipPipPip
  • Advanced Member
  • 49 posts
  • LocationFort Worth, TX

Posted 21 June 2003 - 05:57 AM

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.
Guru?...in my dreams!
Sorry Everybody

----------------------




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users