早教吧作业答案频道 -->英语-->
请问如何用SQLHotel(hotelNo,hotelName,hotelAddress)Room(hotelNo,roomNo,type,price)Guest(guestNo,guestName,guestAddress)Booking(hotelNo,guestNo,dateFrom,dateTo,roomNo)1)Howmanyhotelsarethere?2)Whatistheaveragepriceofaroom?3)What
题目详情
请问如何用SQL
Hotel (hotelNo,hotelName,hotelAddress)
Room (hotelNo,roomNo,type,price)
Guest (guestNo,guestName,guestAddress)
Booking (hotelNo,guestNo,dateFrom,dateTo,roomNo)
1) How many hotels are there?
2) What is the average price of a room?
3) What is the total revenue per night from all double rooms?
4) How many different guests have future bookings in each hotel?
5) List all guests who are currently staying in hotelNo 1.
6) List the number of rooms in each hotel.
7) What is the minimum and maximum price of rooms in each hotel?
8) What is the maximum possible daily revenue for each room size for each hotel?
1.一共多少酒店?
2.房间平均价格是多少?
3.双人房一晚的总共收入是多少?
4.有多少客人预定了酒店?
5.列出一共有多少客人正在hotelNo1.
6.列出每个酒店的房间号码.
7.每个酒店最高和最低价格是多少?
8.每个酒店每种房间一天最高收入是多少?
Hotel (hotelNo,hotelName,hotelAddress)
Room (hotelNo,roomNo,type,price)
Guest (guestNo,guestName,guestAddress)
Booking (hotelNo,guestNo,dateFrom,dateTo,roomNo)
1) How many hotels are there?
2) What is the average price of a room?
3) What is the total revenue per night from all double rooms?
4) How many different guests have future bookings in each hotel?
5) List all guests who are currently staying in hotelNo 1.
6) List the number of rooms in each hotel.
7) What is the minimum and maximum price of rooms in each hotel?
8) What is the maximum possible daily revenue for each room size for each hotel?
1.一共多少酒店?
2.房间平均价格是多少?
3.双人房一晚的总共收入是多少?
4.有多少客人预定了酒店?
5.列出一共有多少客人正在hotelNo1.
6.列出每个酒店的房间号码.
7.每个酒店最高和最低价格是多少?
8.每个酒店每种房间一天最高收入是多少?
▼优质解答
答案和解析
SQL时间我都忘了,呵呵,时间函数就用Oracle替换了,答题的时候加以说明就行,没问题的.
1) How many hotels are there?那里有多少家宾馆?
2) What is the average price of a room?一间房的平均价格是多少?
3) What is the total revenue per night from all double rooms?所有双人间每晚的总收入是多少?
4) How many different guests have future bookings in each hotel?每家宾馆里有多少客人预定了房间?
5) List all guests who are currently staying in hotelNo 1.罗列目前入住第一宾馆的客人
6) List the number of rooms in each hotel.罗列每家宾馆的房间数
7) What is the minimum and maximum price of rooms in each hotel?每家宾馆的最高和最低房价是多少?
8) What is the maximum possible daily revenue for each room size for each hotel?每家宾馆中每种类型的房间最高日收入是多少?
翻译的差别让结果差很多.
1.select count(*) from Hotel
2.select avg(price) from Room r(跟哪家宾馆没关系,题目没要求)
3.需要提供晚间的时间段,假设是晚8点-早8点
select count(r.price) from Room r
where r.type='double rooms'
and exists
(
select b.roomNo from Booking b
where b.roomNo=r.roomNo
and to_number(to_char(b.dateTo,'hh')) < 8
and to_number(to_char(b.dateFrom,'hh')) > 20
)
4.预定就是没入住,入住时间>当前时间
select count(b.guestNo) from Booking b
group by b.hotelNo
having b.dateFrom > sysdate
5.退房时间>当前时间,就是没退房正在居住的
select g.* from Guest g
where g.guestNo in
(
select b.guestNo from Booking b
where b.hotelNo=1
and b.dateTo > sysdate
)
6.select r.hotelNo,count(r.roomNo) from Room r
group by r.hotelNo
7.select r.hotelNo,max(r.price),min(r.price) from Room r
group by r.hotelNo
8.price单位是多少?一天还是一小时?假设是一天.
select count(r.roomNo)*r.price from Room r
group by r.hotelNo,r.type
1) How many hotels are there?那里有多少家宾馆?
2) What is the average price of a room?一间房的平均价格是多少?
3) What is the total revenue per night from all double rooms?所有双人间每晚的总收入是多少?
4) How many different guests have future bookings in each hotel?每家宾馆里有多少客人预定了房间?
5) List all guests who are currently staying in hotelNo 1.罗列目前入住第一宾馆的客人
6) List the number of rooms in each hotel.罗列每家宾馆的房间数
7) What is the minimum and maximum price of rooms in each hotel?每家宾馆的最高和最低房价是多少?
8) What is the maximum possible daily revenue for each room size for each hotel?每家宾馆中每种类型的房间最高日收入是多少?
翻译的差别让结果差很多.
1.select count(*) from Hotel
2.select avg(price) from Room r(跟哪家宾馆没关系,题目没要求)
3.需要提供晚间的时间段,假设是晚8点-早8点
select count(r.price) from Room r
where r.type='double rooms'
and exists
(
select b.roomNo from Booking b
where b.roomNo=r.roomNo
and to_number(to_char(b.dateTo,'hh')) < 8
and to_number(to_char(b.dateFrom,'hh')) > 20
)
4.预定就是没入住,入住时间>当前时间
select count(b.guestNo) from Booking b
group by b.hotelNo
having b.dateFrom > sysdate
5.退房时间>当前时间,就是没退房正在居住的
select g.* from Guest g
where g.guestNo in
(
select b.guestNo from Booking b
where b.hotelNo=1
and b.dateTo > sysdate
)
6.select r.hotelNo,count(r.roomNo) from Room r
group by r.hotelNo
7.select r.hotelNo,max(r.price),min(r.price) from Room r
group by r.hotelNo
8.price单位是多少?一天还是一小时?假设是一天.
select count(r.roomNo)*r.price from Room r
group by r.hotelNo,r.type
看了 请问如何用SQLHotel(...的网友还看了以下:
已知双曲线的右准线x=4,右焦点为F(10,0),离心率e=2,求双曲线的方程.为何不可用e离心率来 2020-03-30 …
感应电动势的应用E=n△φ/△t是感生电动势的公式,因为B的变化才出现了感应电动势,为什么不写成E= 2020-03-30 …
偏导数如何求有一公式E=(Q*m+q)/△t偏导的倒e用e表示其中eE/eQ;eE/em;eE/eq 2020-03-30 …
这些发音如何区分啊?如何发啊因为英语音标中的倒e在这写不出来,我用E代替,&代替bag中那个a的发 2020-05-14 …
请问---在一个导体球壳内放一个电荷量为+q的点电荷,用e表示壳外任一点p的场强,为什么答案是-- 2020-05-16 …
E-51环氧树脂固化剂要做玻璃钢产品,我用E-51环氧树脂+501活性稀释剂+593固化剂,结果固 2020-05-17 …
实体―联系模型可以形象地用E-R图表示。在E-R图中以何种图形表示实体类型?A.菱形B.椭圆形C.矩 2020-05-23 …
如图是化学实验中常用的几种装置.请回答下列问题:(1)指出有编号的仪器名称:①,②.(2)某同学欲收 2020-11-02 …
单调有界收敛准则中的e为何是无理数,怎样得出?在大学高数书上学的lim(n→无穷)(1+1/n)的n 2020-11-21 …
在静电场中,q在计算时何时用正何时用负在静电场中,一些公式像E=F/q等q在计算时何时用正何时用负 2021-01-14 …