I’m maintaining a reservation’s system for a holiday park. I was wondering if it is common practice to keep a Available Accommodations table which could look like this:
Acc AvailableFrom AvailableTo
1 7/1/2010 7/31/2010
2 7/8/2010 7/15/2010
3 7/15/2010 7/20/2010
Because I think it is easier to find an available accommodation this way. Everytime a reservation is made or changed, the Available Accommodations table is updated.
Or is this cumbersome and inefficient?
I don’t think this is common; availability is usally inferred from the fact that there is no reservation at a specific time. That way, you’re always sure that the availability information is up-to-date with the actual bookings.
To make things easier for yourself, you could create a view “Availability” which renders this information.
Now you’re about to duplicate information, which is exactly what you shouldn’t want in a database, unless you’re doing it for very specific, well thought-out reasons.