cssfreakie Posted March 31, 2011 Share Posted March 31, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/232314-many-to-many-relations-quick-question/ Share on other sites More sharing options...
kickstart Posted March 31, 2011 Share Posted March 31, 2011 Hi Can't think of a time when it wouldn't be best to use a link table with a many to many relationship. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/232314-many-to-many-relations-quick-question/#findComment-1195108 Share on other sites More sharing options...
cssfreakie Posted March 31, 2011 Author Share Posted March 31, 2011 Thanks Kickstart! I thought maybe databases got more advanced in the meanwhile. Good they didn't saves me time re reading Cheers! Quote Link to comment https://forums.phpfreaks.com/topic/232314-many-to-many-relations-quick-question/#findComment-1195113 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.