显示成本大于的Sql命令

时间:2015-03-04 13:10:54

标签: sql database

我有3张桌子

CREATE TABLE Hotell 
(
    hotelNum int primary key,
    hotelName varchar(50),
    city varchar(50)
)

CREATE TABLE Roomm
(
    roomNum int primary key,
    hotelNum int ,
    type varchar(50),
    price int 
)

CREATE TABLE Bookingg 
(
    hotelNum int,
    guestNum int primary key,
    dateFrom int,
    dateTo int,
    roomNum int
)

我需要列出每晚花费超过250的酒店的客人,我还希望在我的屏幕中包含酒店名称和城市

1 个答案:

答案 0 :(得分:0)

我希望这可以帮到你

Select 
    A.guestNum,B.hotelName,C.price
From
    Bookingg as [A] Inner Join Hotell as [B] On A.hotelNum = B.hotelNum
    Inner join Roomm as [C] B.hotelNum = C.hotelNum
Where 
    C.price > 250