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

Course : Database Management System (IT00303)

Date set : 21 January 2010


Due date : 4 February 2010
Assignment : 1 (20%)

1) Indexing SQL Server relational databases


a) What is the purpose of indexing?
b) What are the types of indexes?
c) What are the guidelines when creating indexes?

2) 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.

a) List full details of all hotels.

b) List full details of all hotels in London.

c) List the names and addresses of all guests in London, alphabetically ordered by name.

d) List all double or family rooms with a price below £40.00 per night, in ascending order of price.

e) List the bookings for which no date_to has been specified.

f) How many hotels are there?

g) What is the average price of a room?

h) What is the total revenue per night from all double rooms?

i) List the price and type of all rooms at the Grosvenor Hotel.

j) List the number of rooms in each hotel with more than 100 rooms.

You might also like