早教吧作业答案频道 -->英语-->
请问如何用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(...的网友还看了以下:
请懂英语语法的朋友指点.Despitewhatheachievedinmedicine,herema 2020-03-30 …
What's the time on your watch?还是What's the time b 2020-05-16 …
一道感叹句英语题( )pleasant news you have told us!a,how b 2020-05-17 …
what'sthisonthedesk?(it's)abag.括号内改为thereis行不,如果不 2020-07-20 …
whatisthis,is为什么提前呀?我知道,what做疑问词,在问句中要放在句首,那这里的is 2020-07-22 …
ThefilmIsawyesterdayisveryinteresting.a./b.what为什么 2020-10-30 …
根据句意及首字母提示完成单词1.Whatshouldidoatschool?Youshouldobe 2020-10-30 …
“我们可以得到A和B分别与C、D、E之间的关系”这句话用英语怎么表达“我们可以得到A和B分别与C、D 2020-12-25 …
为什么what引导的名词性从句不能用it代替what兼作主从句成分,不用it做形式主语that仅作从 2021-01-07 …
what.time.does.school.start.in.America?这句中的does的作用 2021-02-05 …