Provide the equivalent domain relational calculus and relational algebra expressions for each of the tuple relational calculus expressions given in Exercise 4.10.
(a) {H.hotelName | Hotel(H) ? H.city = ‘London’}
(b) {H.hotelName | Hotel(H) ? (?R) (Room(R) ? H.hotelNo ? R.hotelNo?? R.price ? 50)}
(c) {H.hotelName | Hotel(H) ? (?B) (?G) (Booking(B) ? Guest(G) ? H.hotelNo ?
B.hotelNo?? B.guestNo = G.guestNo ?? G.guestName = ‘John Smith’)}
(d) {H.hotelName, G.guestName, B1.dateFrom, B2.dateFrom | Hotel(H) ? Guest(G) ?
Booking(B1) ? Booking(B2) ? H.hotelNo ? B1.hotelNo??
G.guestNo = B1.guestNo ?? B2.hotelNo = B1.hotelNo ?
B2.guestNo = B1.guestNo ?? B2.dateFrom ? B1.dateFrom}
(a) DRC: {hotelName | (?hNo, cty) (Hotel(hNo, hotelName, cty) ? cty = ‘London’)}
RA: ?hotelName (?city ? ‘London’ (Hotel) )
(b) DRC: {hotelName | (?hNo, cty, rNo, hNo1, typ, prce) (Hotel(hNo, hotelName, cty) ?
Room(rNo, hNo1, typ, prce)???(hNo = hNo1) ? (prce > 50)) }
RA: ?hotelName (Hotel Hotel.hotelNo ? Room.hotelNo (?price ? 50 (Room)) )
DRC: {hotelName | (?hNo, cty, gNo, gName, gAddress, hNo1, gNo1, dFrom, dTo,
rNo) (Hotel(hNo, hotelName, cty) ??
Guest(gNo, gName, gAddress)???
Booking(hNo1, gNo1, dFrom, dTo, rNo) ??(gNo = gNo1) ??
(hNo = hNo1) ??(gName = ‘John Smith’))}
RA: ?hotelName (?guestName ? ‘John Smith’ (Guest) Guest.guestNo ? guestNo (
Booking .Booking.hotelNo ? Hotel.hotelNo Hotel))
(d) DRC: {hotelName, guestName, dateFrom1, dateFrom2 | (?hNo, cty,
gNo, gAddress, hNo1, gNo1, dTo1, rNo1, hNo2, gNo2, dTo2, rNo2)
(Hotel(hNo, hotelName, cty) ??
Guest(gNo, guestName, gAddress)???
Booking(hNo1, gNo1, dateFrom1, dTo1, rNo1) ??
Booking(hNo2, gNo2, dateFrom2, dTo2, rNo2) ??
(hNo = hNo1) ??(gNo = gNo1) ??(hNo2 = hNo1) ??(gNo2 = gNo1) ??
(dateFrom1 ? dateFrom2))}
RA: Booking2(hotelNo, guestNo, dateFrom2, dateTo2, roomNo2) ?
?hotelNo, guestNo, dateFrom, dateTo, roomNo (Booking)
? hotelName, guestName, dateFrom, dateFrom2 (Hotel Hotel.hotelNo ? hotelNo
(Guest Guest.guestNo ? guestNo (Booking Booking.hotelNo ? Booking2.hotelNo
? Booking.guestNo ? Booking2.guestNo ? dateFrom ? dateFrom2 Booking2)))
You might also like to view...
An array element is a variable whose type is the array's item-type.
Answer the following statement true (T) or false (F)
The two most common graph traversal algorithms are depth first traversal and breadth first traversal.
Answer the following statement true (T) or false (F)