यहां एक प्रश्न दिया गया है जो एक निश्चित अवधि के लिए गैर-मुफ़्त कमरे दिखाएगा:
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
आप इसके साथ उपयोग कर सकते हैं
select roomnumber from rooms where roomnumber not in (... as above ...)
मुफ़्त कमरे ढूँढ़ने के लिए