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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.