Consider a relational database for an online hotel booking company. The database consisting of the following tables (where the primary keys are underlined):  Hotel (hId, hName, hAddress, hCity)  Guest(gId, gName, gAddress, gCity)  Room(hid, roomNo, type, price)  Booking(gId, hId, roomNo, fromDate, year, noOfDays) Where hId and gId are identifiers for the hotels and the guests, and the Booking relation indicated that a guest booked a hotel room for a specified number of days (noOfDays) starting from fromDate of a given year. For instance, a tuple < g12345, h5555, 220, Jan05, 2016, 15> in Booking indicates that the guest g12345 booked room 220 of the h5555 hotel for 8 days starting on Jan 5, 2016. The attribute "gAddress" records the home address of the guests. Write the following queries in relational algebra  (1) Return the name of guests who have booked a hotel room in NYC in January 2016 (i.e., fromDate between 01/01 and 01/31 and year=2016). (2) Return the name of guests who have booked a hotel room of type “suite” in NYC for longer than 30 days. (3) Return the name of guests who never booked a hotel room for longer than 3 days. (4) Return the ids of the hotels located in NYC which were not booked at all in the year 2015. (5) Return the ids of the guests who have booked at least one room of type “penthouse suite” in every hotel located in NYC

Database Systems: Design, Implementation, & Management
11th Edition
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Chapter10: Transaction Management And Concurrency Control
Section: Chapter Questions
Problem 1P
icon
Related questions
Question
Consider a relational database for an online hotel booking company. The database consisting of
the following tables (where the primary keys are underlined):
 Hotel (hId, hName, hAddress, hCity)
 Guest(gId, gName, gAddress, gCity)
 Room(hid, roomNo, type, price)
 Booking(gId, hId, roomNo, fromDate, year, noOfDays)
Where hId and gId are identifiers for the hotels and the guests,
and the Booking relation indicated that a guest booked a hotel room for a specified number of days
(noOfDays) starting from fromDate of a given year. For instance, a tuple < g12345, h5555, 220,
Jan05, 2016, 15> in Booking indicates that the guest g12345 booked room 220 of the h5555 hotel
for 8 days starting on Jan 5, 2016. The attribute "gAddress" records the home address of the
guests.
Write the following queries in relational algebra 
(1) Return the
name of guests who have booked a hotel room in NYC in January 2016 (i.e.,
fromDate between 01/01 and 01/31 and year=2016).
(2) Return the
name of guests who have booked a hotel room of type “suite” in NYC for longer than
30 days.
(3) Return the
name of guests who never booked a hotel room for longer than 3 days.
(4) Return the ids of the hotels located in NYC which were not booked at all in the year 2015.
(5) Return the ids of the guests who have booked at least one room of type “penthouse suite” in
every hotel located in NYC
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Dataset
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning