View Single Post
Old 07-16-09, 12:48 PM   #10
ViN86
 
Join Date: Mar 2004
Posts: 15,486
Default Re: Timetable in MySQL

Quote:
Originally Posted by Tuork View Post
That's pretty much what I was thinking, but I also need to store availability (what I referred to as "free periods" before) seeing as most tutors are Uni students and only have certain hours of the day available.

Maybe for that it would be a good idea to use your suggestion and break up the table into days of the week, that way it'll still be a large amount of records for availability, but it'll be much easier to search through.
I guess I don't understand why it will be so large still.

Make a classID called "Free" and have them registered for that when they are not in another class. Or if you return no rows on a query for the tutor times, just assume they are free.

Also, why are you creating time blocks? Use MySQL's ability to store times in the table and enter complete times (ie 2:34PM or 14:34, whichever you prefer). Then when you make entries in the table for a class, make sure that the time you entered falls within the class's times. If you add some error checking code, you can grossly simplify the DB.
ViN86 is offline   Reply With Quote