开发者

Design database for a hotel

Let's think we have a hotel and hotel has 4 room types. I want to hold hotel's capacity for one year. How should i design the database for easiest use.

Example:

A hotel has 40 rooms. 10 x "Standard room", 10 x "Duplex Room", 10 x "Suite room",10 x "Predential Suite".

I will keep this example on standard rooms. Today is: 27.07.2011 I want to keep records from开发者_开发问答 27.07.2011 to 27.07.2012 What i will store in database is available rooms. Something like this(for standard room):

    27.07.2011 : 10

    28.07.2011 : 9 (means 1 standard room sold for this day)

    01.08.2011 : 8 (means 2 standard rooms sold for this day)

    02.08.2011 : 10 (all available for this day)

what should be the structure of the whole database?? I got available and booked room capacity.


You need table that holds types, and you need table, that holds rooms, and another table that holds bookings.

First, you add all types, and add parameters to them.

Second, you add all rooms, and add to each room a type identifier.

At third, when booking accours, you just add a room type and date.

When actual date comes and the one that booked comes to desk and asks what room will he get, your script reads a type of booking, and picks a random room, that is avilable, with that type. After this, the room datatable is updated, that it is currently used with booking ID.


This is a good point to start:

http://en.wikipedia.org/wiki/Relational_algebra

It's the theory for any kind of relational database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜