Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Simple Queries: Submit Your Work in Edmodo in 1 Week

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

30/10/2017 Oct 2017

BMIS 32113 Database


Tutorial Lecture 5 SQL Data Manipulation (i)

Hotel (hotelNo, hotelName, city)


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, hoteINo) forms the primary key;
Booking contains details of bookings and (hoteINo, guestNo, dateFrom) forms the primary key;
Guest contains guest details and guestNo is the primary key.

Simple queries
1. List full details of all hotels.
2. List full details of all hotels in London.
3. List the names and addresses of all guests living in London, alphabetically ordered by name.
4. List all double or family rooms with a price below 40.00 per night, in ascending order of
price.
5. List the bookings for which no dateTo has been specified.

Aggregate functions
6. How many hotels are there?
7. What is the average price of a room?
8. What is the total revenue per night from all double rooms?
9. How many different guests have made bookings for August?

Submit your work in Edmodo in 1 week.

You might also like