Hi, experts:
I've got a question that I want to find all the rooms in a given hotel which is unoccupied and I write the query like that, but it cannot work. can anyone help me to figure out? thank you and waiting for your reply.
the schema for the four tables look like that
hotel(hotelNo,h otelName,city)
room(roomNo,hot elNo,type,price )
booking(hotelNo ,guestNo,dateFr om,dateTo,roomN o)
guest(guestNo,g uestName,guestA ddress)
select roomNo, hotelNo
from room
where
(hotelNo in (select hotelNo from hotel where hotelName='Gros venor')
and
(roomNo,hotelNo not in (select roomNo,hotelNo from booking where dateFrom<curren t_date and dateTo>current_ date))
I've got a question that I want to find all the rooms in a given hotel which is unoccupied and I write the query like that, but it cannot work. can anyone help me to figure out? thank you and waiting for your reply.
the schema for the four tables look like that
hotel(hotelNo,h otelName,city)
room(roomNo,hot elNo,type,price )
booking(hotelNo ,guestNo,dateFr om,dateTo,roomN o)
guest(guestNo,g uestName,guestA ddress)
select roomNo, hotelNo
from room
where
(hotelNo in (select hotelNo from hotel where hotelName='Gros venor')
and
(roomNo,hotelNo not in (select roomNo,hotelNo from booking where dateFrom<curren t_date and dateTo>current_ date))
Comment