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 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 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! 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
Archived
This topic is now archived and is closed to further replies.