currently I'm doing project for hotel booking system. Which is providing self-check-in system to user and it generates room number randomly based on roomtype
selected. It sounds my project quiet weird for me but my supervisor gives me the idea to do so.
So far i've done the self check-in system and randomly generate room number
Now i'm confused in selecting available room
here is the table of room
provided
dor
is date of reservation or checkin date
dco
is checkout date
room_num roomtype dor dco
101 Single 0000-00-00 0000-00-00
102 Single 2014-05-29 2014-05-31
103 Single 0000-00-00 0000-00-00
111 Deluxe 0000-00-00 0000-00-00
112 Deluxe 0000-00-00 0000-00-00
113 Deluxe 2000-00-00 0000-00-00
114 Deluxe 2014-06-01 2014-06-06
115 Deluxe 0000-00-00 0000-00-00
116 Deluxe 2014-06-08 2014-06-11
121 Superior 0000-00-00 0000-00-00
122 Superior 0000-00-00 0000-00-00
0000-00-00
means the room number not yet selected by the system. Because the room_num
selected randomly by system
and below is the table room_booked
. All data below comes from SQL update trigger from rooms
table
room_num roomtype dor dco
102 Single 2014-05-29 2014-05-31
114 Deluxe 2014-06-01 2014-06-06
116 Deluxe 2014-06-08 2014-06-11
now what's the SQL code to select the available room number from room
table, based on selected roomtype
. Which is not at the between checkin date and checkout date mentioned on room_booked
?
Thanks in advance