Distributed

Lesson 07.1

Nightly inventory model & date-range query

Hotel inventory is stored as one row per room type per night, so a stay is available only when every night from check-in up to (not including) check-out has enough free rooms.

A stay with one sold-out night in the middle

Ava and Ben work at a small inn. The computer keeps one number for each kind of room on each night: how many are still free. A guest wants to stay two nights, but one of those nights the Double room is already full.

In this lesson you'll

  1. 1Explain why a room must be free on every night of a stay.
  2. 2Predict what changes before revealing the result
  3. 3Find a stay of 3 nights or more that really has a Double room