Jump to content

many to many relations quick question


cssfreakie

Recommended Posts

Hi guys,

 

Just a quick question, I am not a star in database modeling (yet  ;)) And started reading about it. And was wondering if the following is correctly thought:

 

When designing a database, whenever there is a many to many relationship one should always create an extra table.

For instance:

house               pupil                 choice                 subject
============        ===========           ==========             ==========
houseID      --+    pupilID     ---+      id             +----   subjectID
house_name     |    pupil_name     +---<  pupilID        |       subject
house_master   +--< houseID               subjectID   >--+

where a pupil can choose more subjects, and a subject can be chosen by more pupils

Or is the word "always" incorrect and could this be done in a more clever way.

I am using mysql and the table type is innodb

 

Thanks in advance guys ::)

 

p.s. the example above is from the tutorial of phpfreaks

Link to comment
https://forums.phpfreaks.com/topic/232314-many-to-many-relations-quick-question/
Share on other sites

Archived

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

×
×
  • Create New...

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.