Search code examples
databasetuplesrdbmstuple-relational-calculus

DBMS: Meaning of the following Relational Calculus Example:


The Database has the following tables:

  • Hotel: (hotelNo, hotelName, city)
  • Room: (roomNo, hotelNo, type, price)
  • Booking: (hotelNo, guestNo, dateFrom, dateTo, roomNo)
  • Guest (guestNo, guestName, guestAddress)

Describe the following tuple relational calculus in plain English, as well as, convert it to a relational algebra expression.

{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}


Solution

  • All pairs of bookings made by the same person at the same hotel that do not start on the same date.