用sql语句写,有谁能给个有参考价值的答案?
List the details of all rooms at the Grosvenor Hotel, including the name of guest staying in the room, if the room is occupied.
?
等我学会E文后再来回你!!!
===============================================================
列出Grosvenor旅馆各个房间的详细资料,若该房间已有人入住,则同时列出该客人名字:
select a.hotelNo,a.hotelName,a.city,b.roomNo,b.type,b.price,
isnull((select c.guestName from Guest c,Booking d where c.guestNo=d.guestNo)," ") as guestName
from Hotel a,Room b
where a.hotelNo=b.hotelNo
and hotelName ='Grosvenor'
由于没有表数据测试,大概是这样。
============================================================
8月份订房数:
declare @FromDate nvarchar(30)
declare @ToDate nvarchar(30)
set @FromDate='2008-08-01'
set @ToDate='2008-08-31'
select count(*) from Booking a,Hotel b,Room c where a.hotelNo=b.hotelNo and a.hotelNo=c.hotelNo and b.hotelName ='Grosvenor' and (a.dateFrom BETWEEN cast(@FromDate as datetime) and cast(@ToDate as datetime))
大概也是这样吧。