Assignment
Assignment
ASSIGNMENT 3
• On the cover page, you will need to include your name and student number, the course number (INFO 2312),
your section number (S11), the assignment number (Assignment #3), and the submission date for the
assignment, centered horizontally.
• Answer the questions in the order given below.
• In your answers to questions from Chapter 6 and Chapter 7, you only need to include your SQL syntaxes.
• Due Date: Saturday, July 27/24 at 11 pm.
• Total Mark: 25 pts.
1. Using SQL, create a Hotel table with the attributes: hotelNo, hotelName, city, and price as well as the
following constraints (2 pts).
• Domain constraints so that all domain values come from Table ExpediaHotel;
• Required data constraints so that none of the domain values are null; and
• The Entity Integrity constraint
2. Using SQL, create the Room and Guest tables with the following constraints (2pts):
3. Create a view containing the hotel name and the names of the guests staying at the hotel (2pts).
4. The following tables form part of a database held in a Relational Database Management System (5pts):
INFO 2312 –Assignment 3
d) List all copies of book titles that are available for borrowing.
e) List the names of borrowers with overdue books.
5. The following tables form part of a database held in a relational DBMS. Formulate the following queries
using SQL (10pts).
a) What is the total revenue per night from all double rooms?
b) How many different guests have made bookings for August?
c) List the price and type of all rooms at the Grosvenor Hotel.
d) List the number of rooms in each hotel.
Page 2
INFO 2312 –Assignment 3
e) List all guests currently staying at the Grosvenor Hotel. Note there are two inner select statements.
f) What is the total income from bookings for the Grosvenor Hotel today?
Grouping
Populating Tables
Chapter 14 – Normalization
6. Given the following relational schema and its functional dependencies (4pts):
RentalInfo
custNo propertyNo custName pAddress rentStart ownerNo OName
fd1
fd2
fd3
fd4 fd5
Page 3