0

So I'm making a course table which stores course details, which will be displayed on my website. Now each course will have multiple videos/chapters. Eg: A course named stone age, might have 3 chapters pre historic, mediaeval, modern. I need to store link to these three videos under a single course which is "stone age". How do I do that?

  • Stone Age
    • pre historic
    • mediaeval
    • modern
  • course 2 etc...

My course table has coursename, coursesubject, coursedescription, cprice, cid, cimg. Do I need to make another table to store the media content for this course? Or can it be done using a single table?

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • 2
    'Do I need to make another table to store the media content for this course' - Yes, and do read up on normalisation. – P.Salmon Feb 12 '22 at 11:34
  • You *can* do it any way you like, you *should* create a normallised schema. – Stu Feb 12 '22 at 11:40

1 Answers1

0

I suggest that you create a column for the course, one for the chapter and finally one for the video.

CREATE TABLE course_videos (
   CourseName VARCHAR(25),
   Chapter VARCHAR(25),
   Video VARCHAR(50)
   );

I'm assuming that you're storing a URL for the video and not the video itself. An entry might be:

INSERT INTO course_videos VALUES (
  'Stone Age' ,
   'pre historique'
   'name of the video.mp4'
   );

One simple table will handle the 2 levels of the heirarchy. For the given application I don't anticipate a large number of entries ( <1000) so storage space and optimization of performance are not concerns.

  • WHY do you suggest this approach? – P.Salmon Feb 12 '22 at 12:02
  • @P.Salmon thank you for the question. One simple table will handle the 2 levels of the heirarchy. For the given application I don't anticipate a large number of entries so storage space and optimization of performance are not concerns. –  Feb 12 '22 at 12:07