use FunHotelz
go
--Show all rooms for a given hotel. Show the customer name that is in the room if booked.
select r.RoomNum, h.HotelName, c.CustFirstName, c.CustLastName
from Room r
left outer join xrefRoomCust xRC
on r.RoomID = xRC.RoomID
left outer join Hotel h
on r.HotelID = h.HotelID
left outer join Customer c
on xRC.CustID = c.CustID
where CustLastName = 'Hummer'
--Search for an available room with different options. (Room: # beds, smoking, fridge, hot tub.)
select r.roomNum, h.HotelName, r.NumBeds, r.Smoking, r.HotTub, xRC.DOA
from Room r
left outer join Hotel h
on r.HotelID = h.HotelID
left outer join xrefRoomCust xRC
on r.RoomID = xRC.RoomID
where r.NumBeds = 1
and xRC.DOA is null
No comments:
Post a Comment