Problem
I need to make a database design (ERD) to display a schedule for every instructor, including the following:
- day of course (e.g. Saturday or Monday)
- time it will give course (period from 12 PM TO 03 PM)
- what course it will give (C# or SQL)
Example
Instructor Martin gives course C#, Monday and Saturday, for period 12 pm – 03 pm, and course SQL on Sunday and Wednesday for period 12 pm – 03 pm.
Details
I designed the following tables:
- Instructors table (InstructorID, InstructorName)
- Courses table (CourseID, CourseName)
- Instructors_courses table (instcourseID, InstructorID, CourseID)
Relationship between Instructors table and Courses table is many to many so I do another table Instructors_Courses.
Questions
-
How to represent days and times for every course added
Can I add table for time and table for days and make relation with Instructors_courses table by adding day id and time id (one to many)
OR do it programming from user interface.
-
course start date and course end date these two fields how to represent in table Instructors_courses.
I can added but it will repeated with every course are this correct or what.
Best Answer
Try making the instructor_course table like this
Then you could also add some constraint to the table if you want to enforce a rule that two courses can't be timetabled at the same time. If a course has multiple sessions during the week each will be a row in this table.