CC116 DBMS/CB203 DB Systems
Tutorial 6
Question:
The following tables form part of a database held in a relational DBMS.
Hotel (hotelNo, name, address)
Room (roomNo, hotelNo, type, price)
Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo)
Guest (guestNo, name, address)
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 the bookings and the primary key comprises
hotelNo, guestNo and dateFrom.
• Guest contains guest details and guestNo is the primary key.
Construct an SQL statement to answer the following queries.
1. List the names and addresses of all guests in London, alphabetically ordered by
name.
2. How many hotels are there?
3. What is the average price of a room?
4. What is the total revenue per night from all double rooms?
5. List the price and type of all rooms at the Grosvenor Hotel.
CC116 DBMS/CB203 DB Systems