Zde je dotaz, který zobrazí NEZDARMA pokoje pro určité časové období:
select room from bookings where
(arrival<'2011-03-12' and departure>='2011-03-12') -- overlap at the end
OR (arrival<='2011-03-10' and departure>'2011-03-10') -- overlap at the start
OR (arrival>='2011-03-10' and departure<='2011-03-12') -- complete overlap
Můžete to použít s
select roomnumber from rooms where roomnumber not in (... as above ...)
najít pokoje ZDARMA