Provide the equivalent tuple relational calculus and domain relational calculus expressions for each of the relational algebra queries given in Exercise 4.8.
a) ?hotelNo (?price ? 50 (Room) )
b) ?Hotel.hotelNo ? Room.hotelNo(Hotel ? Room)
c) ?hotelName (Hotel Hotel.hotelNo ? Room.hotelNo (?price ? 50 (Room)) )
d) Guest (?dateTo ? ‘1-Jan-2007’ (Booking))
e) Hotel Hotel.hotelNo ? Room.hotelNo (?price ? 50 (Room)) )
f) ?guestName, hotelNo (Booking Booking.guestNo ? Guest.guestNo Guest) ?
a) ?hotelNo (?price ? 50 (Room) )
TRC: {R.hotelNo | Room(R) ? R.price ? 50}
DRC: {hotelNo | (?rNo, typ, prce) (Room (rNo, hotelNo, typ, prce) ? prce ? 50)}
b) ?Hotel.hotelNo ? Room.hotelNo(Hotel ? Room)
TRC: {H, R | Hotel(H) ? (?R) (Room(R) ? (H.hotelNo ? R.hotelNo))}
DRC: {hNo, hName, cty, rNo, hNo1, typ, prce | (Hotel(hNo, hName, cty) ?
Room(rNo, hNo1, typ, prce)???(hNo = hNo1))}
c) ?hotelName (Hotel Hotel.hotelNo ? Room.hotelNo (?price ? 50 (Room)) )
TRC: {H.hotelName | Hotel(H) ? (?R) (Room(R) ? (H.hotelNo ? R.hotelNo) ?
(R.price > 50))}
DRC: {hotelName | (?hNo, cty, rNo, hNo1, typ, prce)
(Hotel(hNo, hotelName, cty) ? Room(rNo, hNo1, typ, prce)???(hNo = hNo1) ??
(prce > 50))}
d) Guest (?dateTo ? ‘1-Jan-2007’ (Booking))
TRC: {G.guestNo, G.guestName, G.guestAddress, B.hotelNo, B.dateFrom,
B.dateTo, B.roomNo | Guest(G) ? (?B) (Booking(B) ?
(G.guestNo ? B.guestNo) ? (B.dateTo > ‘1-Jan-2007’))}
DRC: {guestNo, guestName, guestAddress, hotelNo, dateFrom, dateTo, roomNo |
(?gNo1) (Guest(guestNo, guestName, guestAddress) ??
?Booking(hotelNo, gNo1, dateFrom, dateTo, roomNo)???
(guestNo = gNo1) ??(dateTo ? ‘1-Jan-2007’)))}
e) Hotel Hotel.hotelNo ? Room.hotelNo (?price ? 50 (Room)) )
TRC: {H.hotelNo, H.hotelName, H.city | Hotel(H) ? (?R) (Room(R) ?
(H.hotelNo ? R.hotelNo) ? (R.price > 50))}
DRC: {hotelNo, hotelName, city | (?rNo, hNo1, typ, prce)
(Hotel(hotelNo, hotelName, city) ? Room(rNo, hNo1, typ, prce)???
(hotelNo = hNo1) ? (prce > 50))}
f) ?guestName, hotelNo (Booking Booking.guestNo ? Guest.guestNo Guest) ?
?hotelNo (?city ??’London’(Hotel))
TRC: {G.guestName | Guest(G) ??? (?H) (Hotel(H) ?
(H.city = ‘London’) ? (?(?B) (Booking(B) ??
G.guestNo ? B.guestNo ??H.hotelNo ? B.hotelNo))))}
DRC: {guestName | (?gNo, gName, gAddress, hNo, gNo1, dFrom, dTo, rNo,
hName, cty, hNo1, typ, prce) (??Hotel(hNo, hName, cty) ?
(cty = ‘London’) ??Guest(gNo, gName, gAddress)???
Booking(hNo1, gNo1, dFrom, dTo, rNo) ??
(gNo = gNo1) ??(hNo = hNo1)))}
You might also like to view...
The ____________________ view displays your document with minimized toolbars at the top of the window.
Fill in the blank(s) with the appropriate word(s).
You also can include a range of values in a character list by using a(n) ____ to separate the lowest value in the range from the highest value in the range.
A. hyphen B. apostrophe C. equal sign D. plus sign