0

Can anyone tell me what will be the best way to make the tables for the following diagram:

enter image description here

I was thinking about this:

videos
------

 - id 
 - title 

music_videos
------------
 - id
 - video_id
 - artist
 - genre

lessons
-------
 - id
 - video_id
 - teacher

Is it right?

(i'm using MySQL if that makes any difference)

1 Answer 1

1

Smells a bit like homework this, but ....

Why do you have an id column on music_videos? Can one music_videos be multiple videos? And likewise for lessons? Those two id columns seems redundant.

Other than that, from the information given, it seems decent enough.

Generally speaking, you'll need to decide on some structure between the data, what belongs to where, what is inherited from others, and then make the tables depending on the cardinalities which arise from those.

1
  • I agree with @Allan. If the diagram means that a "Video" can be a "Music_video" or a "Lesson", then you only need video_id in all 3 tables (and 1:1 relationships.) If a Video can have many Music_Videos or many Lessons, then the relationships would be 1-to-many. Nov 25, 2013 at 9:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.