Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Let me try to summarize your question to see if I understand it properly:</p> <blockquote> <p>You have a set of Hotels. Each Hotel has a set of Rooms. Each Room belongs to one of a number of possible Room Types. The lowest level of detail we're interested in here is a Room.</p> </blockquote> <p>This suggests a table of Hotels, a lookup table of Room Types, and a table of Rooms: each Room will have a reference to its associated Hotel and Room Type.</p> <blockquote> <p>For any given day, a room is either booked (sold) or not booked (let's leave off partial days for simplicity at this point). For each day in the year before and the year after the current day, you wish to know how many rooms of each type were available (non-booked) at each hotel.</p> </blockquote> <p>Now, since hotels need to be able to look at bookings individually, it's likely you would maintain a table of bookings. But these would typically be defined by a Room, a Start Date, and a number of Nights, which isn't ideal for your stated reporting purposes: it isn't broken down by day.</p> <p>So you may wish to maintain a "Room Booking Log" table, which simply contains a record for each room booked on each day: this could be as simple as a datestamp column plus a Room ID.</p> <p>This sort of schema would let you generate the output you're describing relatively easily via aggregate queries (displaying the sum of rooms booked per day, grouped by hotel and room type, for example). The model also seems like it would lend itself to an <a href="http://en.wikipedia.org/wiki/Olap_cube" rel="nofollow">OLAP cube</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload