a) Write a query to list the hotel numbers and room numbers of any single rooms
ID: 3715049 • Letter: A
Question
a) Write a query to list the hotel numbers and room numbers of any single rooms that are cheaper than ?60.
b) Write a query to list names and cities of all London and Liverpool location hotels.
c) Write a query to list the guest names who are scheduled to check in today.
d) Write a query to list hotel names and its double room count for hotels locates in London.
e) Write a query to list the check-in date and check-out date of a guest named John Smith.
The following tables form part of a database held in a relational DBMS: city) Hotel (hotelNo, hotelName, Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo dateFrom dateTo, roomNo) Guest (guestNo, guestName, guestAddress) where Hotel contains hotel details and hotelNo is the primary key, Room contains room details for each hotel and (roomNo, hotelNo) forms the primary key; Booking contains details of bookings and (hotelNo, guestNo, dateFrom) forms the primary key Guest contains guest details and guestNo is the primary key.Explanation / Answer
a) Write a query to list the hotel numbers and room numbers of any single rooms that are cheaper than ?60.
Answer : select hotelNo, roomNo from hotel h , room r where h.hotelNo = r.hotelNo and r.price<60;
b) Write a query to list names and cities of all London and Liverpool location hotels.
Answer : select hotelName, city from hotel where city in(London,Liverpool);
c) Write a query to list the guest names who are scheduled to check in today.
Answer : select guestName from guest where guest.guestNo=booking.guestNo and dateFrom ='sysdate';
d) Write a query to list hotel names and its double room count for hotels locates in London.
Answer : select h.hotelName,count(r.type) from hotel h, room r where h.hotelNo = r.hotelNO and r.type='double' and h.city='London';
e) Write a query to list the check-in date and check-out date of a guest named John Smith.
Answer: select b.dateFrom, b.dateTo from Booking b , Guest g where b.guestNo=g.guestNo and g.guestName ='John Smith';
Thanks...
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.