Designing multiple many-to-one relationships on a single table

46 Views Asked by At

My lesson table should have many media content (not media content many lessons). Lesson references mediacontent using junction table, but the relationships are not many-to-many:

Lesson references mediacontent using junction table, but the relationships is not many-to-many

I didn't define the relationship with foreign key on media table because there are tables that need to be added. Talk and qiraat tables have to have many media content as well. Should I reference them with junction table even if the relationships are not many-to-many? Or is it ok (sound design) to add three foreign keys (lesson_id, talk_id, qiraat_id) to mediacontent table?

1

There are 1 best solutions below

0
Muhammad Umar Valeed On

Adding foreign keys (lesson_id, talk_id, qiraat_id) directly to the MediaContent table might not be the best approach because it could lead to redundancy and potential inconsistency. Using a junction table allows you to maintain a cleaner database design and enforce referential integrity. Each lesson, talk, or qiraat can have its own entry in the junction table, referencing the appropriate media content.