Describe the relations that would be produced by the following tuple relational calculus expressions:
(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) {H.hotelName | Hotel(H) ? H.city = ‘London’}
This will produce a relation containing the names of all hotels in London.
(b) {H.hotelName | Hotel(H) ? (?R) (Room(R) ? H.hotelNo ? R.hotelNo?? R.price ? 50)}
This will produce a relation containing the names of all hotels that have a room price
above £50.
(c) {H.hotelName | Hotel(H) ? (?B) (?G) (Booking(B) ? Guest(G) ? H.hotelNo ?
B.hotelNo?? B.guestNo = G.guestNo ?? G.guestName = ‘John Smith’)}
This will produce a relation containing the names of all hotels that have a booking for
a guest called 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}
This will produce a relation containing the names of guests who have more than one
booking at the same hotel, along with the hotel number and the dates of the bookings.
You might also like to view...
What block of addresses is designated "link-local"?
What will be an ideal response?
_____ are mark-up code in an HTML document that tells the Web browser how to format the text when displaying it. B
A. Attributes B. Tags