Reputation: 37377
This data is for a holiday cottage's simple accommodation calendars. The data is simple and stores dates when each cottage is booked.
The cols would be cottage_id, booked_from_date, booked_until_date
and I would expect around 60 rows per user per year * 200-300 users.
I should put this is one table right?
Upvotes: 2
Views: 220
Reputation: 41
I think Randy's answer is good... another idea to add to his would be to use a calendar table like:
COTTAGE_CALENDAR
Add a single row for each day of booking and make the cottage_id and date fields a combined primary key....then you'll prevent overbooking... (adding the reservation_id to the COTTAGE_RESERVATION table that Randy built, for the relational data link)....
Upvotes: 0
Reputation: 166356
Yes, this should be placed in a single table (for all cottages).
You will run into a whole world of hurt when you start placing data that should be in a single table (that can be seperated by a defining type/id) into seperate tables.
Just think of how you are to write a query to retrieve availability accross all units, for a given date, accross 10-40 or more units?
Normalizing the table into a MANY to MANY structure is perfectly normal, seperating Cottages from Users and linked by a table CottageUsers with the booked dates.
Upvotes: 1
Reputation: 16677
cottage_id,
address?,
other info...
user_id,
name,
other info...
cottage_id,
user_id,
from_date,
to_date
Upvotes: 7