Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 4 Hotel (hotelno, hotelname, city)

Similar presentations


Presentation on theme: "Chapter 4 Hotel (hotelno, hotelname, city)"— Presentation transcript:

1 Chapter 4 Hotel (hotelno, hotelname, city)
Room (roomno, hotelno, Type, price) Booking (hotelno, guestno, datefrom, dateto, roomno) Guest (guestno, guestname, guestaddress)

2 List all hotels Hotel (hotelno, hotelname, city)
Room (roomno, hotelno, Type, price) Booking (hotelno, guestno, datefrom, dateto, roomno) Guest (guestno, guestname, guestaddress)

3 List all hotels. Project Hotel over (hotelno, hotelname) giving T1 Or Project Hotel over (hotelno, hotelname, city) giving T1

4 List all single rooms with a price below $20 per night
Hotel (hotelno, hotelname, city) Room (roomno, hotelno, Type, price) Booking (hotelno, guestno, datefrom, dateto, roomno) Guest (guestno, guestname, guestaddress)

5 List all single rooms with a price below $20 per night.
Select Room where price<20 and type=‘single’ giving T1

6 List the names and addresses of all guests
Hotel (hotelno, hotelname, city) Room (roomno, hotelno, Type, price) Booking (hotelno, guestno, datefrom, dateto, roomno) Guest (guestno, guestname, guestaddress)

7 List the names and addresses of all guests.
Project Guest over (guestname, guestaddress) giving T1

8 List the price and type of all rooms at Grosvenor Hotel
Hotel (hotelno, hotelname, city) Room (roomno, hotelno, type, price) Booking (hotelno, guestno, datefrom, dateto, roomno) Guest (guestno, guestname, guestaddress)

9 List the price and type of all rooms at Grosvenor Hotel.
Room join Hotel where Room.hotelno = Hotel.hotelno giving T1 Select T1 where hotelname=‘Grosvenor’ giving T2 Project T2 over (type, price) giving T3

10 List all guest currently staying at the Grosvenor Hotel
Hotel (hotelno, hotelname, city) Room (roomno, hotelno, Type, price) Booking (hotelno, guestno, datefrom, dateto, roomno) Guest (guestno, guestname, guestaddress)

11 List all guest currently staying at the Grosvenor Hotel.
Hotel join Booking where Hotel.hotelno = Booking.hotelno giving T1 T1 join Guest where T1.guestno = Guest.guestno giving T2 Select T2 where hotelname=‘Grosvenor’ and datefrom <= ‘systemdate’ and dateto >= ‘systemddate’ giving T3 Project T3 over (Guest.guestno, Guest.guestname) giving T4

12 List the details of all rooms at the Grosvenor Hotel, including the name of the guest staying in the room, if the room is occupied Hotel (hotelno, hotelname, city) Room (roomno, hotelno, Type, price) Booking (hotelno, guestno, datefrom, dateto, roomno) Guest (guestno, guestname, guestaddress)

13 Hotel join Room where Hotel.hotelno = Room.hotelno giving T6
Select T6 where hotelname=‘Grosvenor’ giving T7 Project T7 over (roomno, hotelno, type, price) giving T8

14 Hotel join Booking where Hotel.hotelno = Booking.hotelno giving T1
T1 join Guest where T1.guestno = Guest.guestno giving T2 Select T2 where hotelname=‘Grosvenor’ and datefrom <= ‘systemdate’ and dateto >= ‘systemdate’ giving T4 Project T4 over (roomno, guestname) giving T5

15 T5 right outer join T8 where T5.roomno = T8.roomno giving T9

16 List the guest details (guestno, guestname, and guestaddress) of all guests staying at the Grosvenor Hotel Hotel (hotelno, hotelname, city) Room (roomno, hotelno, Type, price) Booking (hotelno, guestno, datefrom, dateto, roomno) Guest (guestno, guestname, guestaddress)

17 Hotel join Booking where Hotel.hotelno = Booking.hotelno giving T1
Select T1 where hotelname=‘Grosvenor’ and datefrom <= ‘systemdate’ and dateto >= ‘systemdate’ giving T2 Guest semijoin T2 where Guest.guestno = T2.guestno giving T3

18 Create a view of all rooms in the Grosvenor Hotel, excluding price details. State advantages.
Hotel (hotelno, hotelname, city) Room (roomno, hotelno, Type, price) Booking (hotelno, guestno, datefrom, dateto, roomno) Guest (guestno, guestname, guestaddress)

19 Create a view of all rooms in the Grosvenor Hotel, excluding price details.
Room join Hotel where Room.hotelno = Hotel.hotelno giving T1 Select T1 where hotelname=‘Grosvenor’ giving T2 Project T2 over (roomno, type) giving T3 Advantages: security, user friendly, performance


Download ppt "Chapter 4 Hotel (hotelno, hotelname, city)"

Similar presentations


Ads by Google