0% found this document useful (0 votes)
14 views3 pages

Assignment

Uploaded by

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

Assignment

Uploaded by

Rajan Thakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

KWANTLEN POLYTECHNIC UNIVERSITY

INFO 2312 – Summer 2024

ASSIGNMENT 3

Chapter 7 (Data Modification) , Chapter 6 (Data Manipulation), and Chapter 14 (Normalization)

• 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.

Chapter 7 – Data Modification

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

Note: In the first step, define the data types.

2. Using SQL, create the Room and Guest tables with the following constraints (2pts):

a) Type must be one of Single, Double, or Family.


b) Price must be between $10 and $100.
c) roomNo must be between 1 and 100.
d) dateFrom and dateTo must be greater than today’s date.

3. Create a view containing the hotel name and the names of the guests staying at the hotel (2pts).

Chapter 6 – Data Manipulation

4. The following tables form part of a database held in a Relational Database Management System (5pts):
INFO 2312 –Assignment 3

Simple Queries and Aggregate Functions:

a) List all book titles published in the year 2012.


b) How many copies of ISBN “0-321-52306-7” are there?
c) How many copies of ISBN “0-321-52306-7” are currently available?

Subqueries and Joins

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

Simple Queries and Aggregate Functions:

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

Subqueries and Joins

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

g) List the number of rooms in each hotel in London?


h) What is the most commonly booked room type for each hotel in London?

Populating Tables

i) Insert records into each of these tables?


a) Update the price of all rooms by 5%.

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

a) Specify candidate keys and state the primary key.


b) Assuming that the relation is in first normal form (1NF), transfer table form 1NF to 2NF and 2NF to
3NF. Identify the primary and foreign keys in your 3NF tables.

Page 3

You might also like