View Single Post
Old 07-16-09, 09:20 AM   #8
Join Date: Mar 2004
Posts: 15,488
Default Re: Timetable in MySQL

Why do you need a record for all students/tutors at all times? Just add them as you need them.

Don't make a record for empty tutor hours. If we have 200 tutors and 20 classes, assuming each tutor has a time in each class, for all 5 days of the week, then the number of records is only 20000. A large reduction from the system you're proposing. Also, that is the maximum, since most tutors will have a few classes but not every day.

Here's what I was thinking:

Table 1:
List of students and tutors (studentID,Student or Tutor,Name,email,etc.)

Table 2:
List of courses (courseID,name,room,start_time,end_time)

Table 3:
List of tutor times (entryID,courseID,studentID,start_time,end_time)

Then, don't keep an entire record of all times. Just add entries to the tutor times (table 3) as you get them. Then if you want to check if there is a tutor for a class at a certain time, run a query and if you get no rows returned, then there isn't a tutor. If you still think the tutor times will be too large, then split it up by day and create a table for each day of the week (ie MondayTutorTimes, TuesdayTutorTimes, etc.)
ViN86 is offline   Reply With Quote