COMSATS University Islamabad, Islamabad Campus
Department of Computer Science
LAB Assignment 1 - SPRING 2024
Subject: CSC402 -DataBase Systems Instructor : Mr. Muhammad Haris
Total Marks: 30
(CLO-5) [Apply data processing operations on both relational and non-relational DBMS.]
The following tables form part of a database held in a relational DBMS:
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, hotelNo) forms the primary key;
Booking contains details of the bookings and (hotelNo, guestNo, dateFrom) forms the
primary key;
and Guest contains guest details and guestNo is the primary key.
Q1) Describe the relations that would be produced by the following relational algebra operations:
(a) hotelNo (price 50 (Room) )
(b) Hotel.hotelNo Room.hotelNo(Hotel Room)
(c) hotelName (Hotel IXI Hotel.hotelNo Room.hotelNo (price 50 (Room)) )
(d) Guest XI (dateTo ‘1-Jan-2002’ (Booking))
(e) Hotel I> Hotel.hotelNo Room.hotelNo (price 50 (Room)) )
(f) guestName, hotelNo (Booking IXIBooking.guestNo Guest.guestNo Guest)
hotelNo (city ’London’(Hotel))
Q2) Generate the relational algebra expressions for the following queries :
(a) List all hotels.
(b) List all single rooms with a price below £20 per night.
(c) List the names and cities of all guests.
(d) List the price and type of all rooms at the Grosvenor Hotel.
(e) List all guests currently staying at the Grosvenor Hotel.
(f) List the details of all rooms at the Grosvenor Hotel, including the name of the guest staying in theroom, if
the room is occupied.
(g) List the guest details (guestNo, guestName, and guestAddress) of all guests staying at the
Grosvenor Hotel.