0% found this document useful (0 votes)
145 views

Database Systems Homework 2

This document provides instructions for Home Assignment II on Database Systems. Students are to work in groups of at most three from the same lab/tutorial class. The assignment involves sample tables for Hotel, Room, Booking, and Guest relations and identifying foreign keys and integrity rules. Students are asked to write relational algebra expressions to query the tables, listing things like hotel names, single rooms under $200, guest names and cities, and room prices and types at a specific hotel. Extra credit is offered for running the queries through a relational algebra interpreter.

Uploaded by

Mohammad Arfan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 views

Database Systems Homework 2

This document provides instructions for Home Assignment II on Database Systems. Students are to work in groups of at most three from the same lab/tutorial class. The assignment involves sample tables for Hotel, Room, Booking, and Guest relations and identifying foreign keys and integrity rules. Students are asked to write relational algebra expressions to query the tables, listing things like hotel names, single rooms under $200, guest names and cities, and room prices and types at a specific hotel. Extra credit is offered for running the queries through a relational algebra interpreter.

Uploaded by

Mohammad Arfan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DATABASE SYSTEMS CSY 2013

SECOND YEAR 2013-2014


SEMESTER-I

Database Systems CSY 2013

Home Assignment II

Date of Issue 14th Oct 2013

Date of Submission 24th Oct 2013(5:00 PM)

This assignment can be done in groups of at-most three students. All students of the group
should belong to the same lab/tutorial class.
IMPORTANT----Group of students from different lab/tutorial class will not be
accepted.
The following tables form part of a database held in a relational DBMS:Hotel
Room
Booking
Guest

(hotelNo, hotelName, city)


(roomNo, hotelNo, type, price)
(hotelNo, guestNo, dateFrom, dateTo, roomNo)
(guestNo, guestName, guestAddress)

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, type may be single room, double room, etc. (Try to find from some hotel booking
agency website);
Booking contains details of the bookings and (hotelNo, guestNo, dateFrom) forms the
primary key;
Guest contains guest details and guestNo is the primary key.
(i) Identify the foreign keys in this schema. Explain how the entity and referential
integrity rules apply to these relations.
(ii) Produce some sample tables for these relations that observe the relational integrity
rules. Suggest at least 10 general constraints that would be appropriate for this
schema.
(iii) Write the relational algebra expressions for the following queries:
(a)

List all hotels names

(b)

List all single rooms with a price below RM 200.00 per day.

(c)

List the names and cities of all guests.

(d)

List the price and type of all rooms at the Grand Hotel.

( e) List the guest details (guestNo, guestName, and guestAddress) of all guests currently
staying at the Grand Hotel.
(f ) List the details of all rooms at the Grand Hotel, including the name of the guest staying
in the room, if the room is occupied. (you will need outer join for this question)

Relational Algebra queries can also be run using Relational Algebra interpreter.
Extra credit of 5 marks for those who do the relational algebra queries using the interpreter.
https://code.google.com/p/relational-algebra/

You might also like