Uploaded by Syam Tasya

Exercise Chapter 4 (1)

advertisement
Exercise Chapter 4
1. 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
(d) Guest
(e) Hotel
Hotel.hotelNo = Room.hotelNo(σprice > 50(Room)))
(σdateTo ≥ ‘1-Jan-2019’(Booking))
Hotel.hotelNo = Room.hotelNo(σprice > 50(Room))
(f) ΠguestName, hotelNo(Booking
Booking.guestNo = Guest.guestNo Guest)
÷ ΠhotelNo(σcity = ‘Jakarta’(Hotel))
2. Create Relational Algebra
(a) List all hotels.
(b) List all single rooms with a price below £50 per night.
(c) List the names and cities of all guests.
(d) List the price and type of all rooms at the Aston Hotel.
(e) List all guests currently staying at the Aston Hotel.
(f) List the details of all rooms at the Aston Hotel, including the name of the guest staying in the room, if
the room is occupied.
(g) List the guest details (guestNo, guestName, and guestAddress) of all guests staying at the Aston
Hotel.
Hotel
hotelNo
H001
H002
H003
H004
hotelName
Hilton
Aston
Four Season
Ibis
city
Jakarta
Denpasar
Surabaya
Jakarta
Room
roomNo
r01
r02
r03
r04
hotelNo
type
Deluxe
Superior
Deluxe
Superior
H001
H002
H003
H003
price
75
60
45
40
Booking
hotelNo
H001
H002
H003
H004
guestNo
G101
G103
G104
G101
dateFrom
08-10-2019
13-01-2019
18-07-2019
11-12-2019
dateTo
10-10-2019
15-01-2019
20-07-2019
11-12-2019
Guest
guestNo
G101
G102
G103
G104
guestName
Ferry
Anna
Daniel
Grace
guestAddress
Avenue St
Main Forest St
Sudirman St
Brisbane Road
roomNo
r02
r04
r02
r03
Download