How do i store routine or schedule in Database in efficient way.Such as i have 20 rooms and in this rooms 8-10,10-12,... this way classes are held.How do i store this sort of schedule in database in efficient way?
A:
I would have two tables: Rooms and RoomSchedule.
RoomSchedule (ID int primary key, RoomID int /foreign key to rooms/, From int, To int )
This will allow you to easily check for availability and conflicts, later on, and produce reports.
Nick
2010-07-09 07:29:15
A:
room
--------------
id INT PK<------------
[more data like] |
room INT/VARCHAR |
seats INT |
Foreign Key
room_schedule |
--------------- |
id INT PK |
room_id INT<----------
start DATETIME
end DATETIME
You can now eaisly attach certain times to a specific room. To have the start/end in a databasespecific format allows you to transform it in other display of the time.
DrColossos
2010-07-09 07:35:15
A:
One table for the rooms with their properties.
One table for the bookings, with their properties.
Simple normalization.
MattBianco
2010-07-09 07:38:16
+1
A:
It depends on your requironments eg reporting, leagal and so on.
For an introduction to this problem see Developing Time-Oriented Database Applications in SQL (Snodgrass) and Patterns for things that change with time (Fowler)
oluies
2010-07-09 11:12:38