-1

I'm trying to write a sql query into relational algebra. If I have:

  • Hotel(hotelNo,hotelName,hotelStreet,hotelCity,hotelState)
  • Room(roomNo, hotelNo, type, price)
  • guest (guestNo, guestName, guestStreet, guestCity)
  • Booking(hotelNo, guestNo, datFrom, dateTo, roomNo)

I'm wondering how to write what rooms are occupied in 3-17-2014 in relational database

tarzanbappa
  • 4,930
  • 22
  • 75
  • 117
Troy Griffiths
  • 351
  • 2
  • 7
  • 17

1 Answers1

0
select * from hotel h 
inner join room r on h.hotelno=r.hotelno 
inner join booking b on b.hotelno=r.hotelno  and b.roomno = r.roomno
inner join guest g on g.guestno = b.guestno
where '<yourdate>' between b.datFrom and b.dateTo

try this

Anto Raja Prakash
  • 1,328
  • 8
  • 12
  • I think what OP means to say is: write the query using `Relational algebra calculas` like `Tuple Calculas` and `Domain Calculas`; and not using SQL. – Rahul Jan 30 '14 at 12:24