0% found this document useful (0 votes)
31 views1 page

Simple Queries: Submit Your Work in Edmodo in 1 Week

The document outlines the schema of a database for a hotel booking system including tables for hotels, rooms, bookings, and guests. It then lists simple queries that can be run on the database such as listing hotel details or guest information. Finally, it provides examples of queries using aggregate functions to calculate values like the number of hotels, average room price, and number of guests booking in a given month.

Uploaded by

wirdina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Simple Queries: Submit Your Work in Edmodo in 1 Week

The document outlines the schema of a database for a hotel booking system including tables for hotels, rooms, bookings, and guests. It then lists simple queries that can be run on the database such as listing hotel details or guest information. Finally, it provides examples of queries using aggregate functions to calculate values like the number of hotels, average room price, and number of guests booking in a given month.

Uploaded by

wirdina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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