Question

2. The following tables form part of a database hield in a relatioual DBMS: (10 Points) Hotel Room Booking Guest hotelNo, hot
1 0
Add a comment Improve this question Transcribed image text
Answer #1

Please rate the answer. Feel free to contact me, in case of any more clarifications required

Question_01.LIST the Price and type of all rooms at Shangri-La HOTEL
Answer => 
                select  a.price,
                                a.type                          
                From Room a,
                         HOTEL b
                Where a.HotelNo = b.HotelNo
                And HotelName = 'Shangri-La';

Explanation:
Pick Data [Price and type] from ROOM table and join with HOTEL table to filter for 'Shangri-La' Hotel

Output Question_01:

select * from hotel; select * from Room; select a price, a. type From Room a, HOTEL b Where a.HotelNo = b. HotelNo And HotelN

Question_02. LIST all guests staying in Shangri-La HOTEL between January 1 and January 31, 2020.
Answer => 
                Select a.GuestName
                From Guest a,
                     Booking b
                where a.GuestNo = b.GuestNo
                And b.dateFrom >= '01-JAN-2020' 
                AND b.dateto <= '31-JAN-2020';

Explanation:
Fetch the Guest Name from GUEST Table and join with BOOKING Table using the GuestNo field.

Filter the data using DATEFROM and DATETO field in BOOKING Table.
Filter Condition => Guest Staying in the hotel between ist January 2020 and 31st January 2020.

Output Question_02:

select * from Booking; select * from Booking; select * from Booking; select * from guest; select * from guest; select * from

Question_03. List the details of all rooms at 'Shangri-La'Hotel including the name of the guest staying in the room between January 1 and January 31, 2020, 
if the room is occupied.

Answer =>
Select c.*,
       a.GuestName
From Guest a,
     Booking b,
     room c
where a.GuestNo = b.GuestNo
And b.RoomNo = c.RoomNo
And b.dateFrom >= '01-JAN-2020' 
AND b.dateto <= '31-JAN-2020';

Explanation: 
Add Room details to the query given for the Question_02.
The join condition field will be RoomNo, which is the primary key Room Table and Foreign Key in Booking Table. 
The Query will omit the records where hotel stay is extended beyond '31-JAN-2020'.
So only two records will be displayed, The thrid record will be omitted since the guest is staying till 3rd Feb 2020.

Output Question_03:

G Select c.*, a. Guest Name From Guest a, Booking b, room c where a. GuestNo = b. GuestNo And b. RoomNo = c.RoomNo And b.date

Add a comment
Know the answer?
Add Answer to:
2. The following tables form part of a database hield in a relatioual DBMS: (10 Points)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName,...

    The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress) where Hotel contains hotel details and hotelNo is the primary key; Room contains room details for each hotel and (roomNo, hoteINo) forms the primary key; Booking contains details of bookings and (hoteINo, guestNo, dateFrom) forms the primary key; Guest contains guest details and guestNo is the primary key....

  • Create the following tables as part of a Hotel Business database: 1. Hotel (hotelNo, hotelName, city)...

    Create the following tables as part of a Hotel Business database: 1. Hotel (hotelNo, hotelName, city) where Hotel contains hotel details and hotelNo is the primary key 2. Room (roomNo, hotelNo, type, price) Room contains room details for each hotel and (roomNo, hotelNo) forms the primary key 3. Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Booking contains details of bookings and (hotelNo, guestNo, dateFrom) forms the primary key 4. Guest (guestNo, guestName, guestAddress) Guest contains guest details and guestNo is the...

  • HOW TO DO THIS DATABASE QUESTION USING ORACLE? Hotel (hotelNo, hotelName, hotelAddress, country) Room (roomNo, hotelNo,...

    HOW TO DO THIS DATABASE QUESTION USING ORACLE? Hotel (hotelNo, hotelName, hotelAddress, country) Room (roomNo, hotelNo, type, price) Guest (guestNo, guestName, guestAddress, country) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) (a).List all guests currently staying at the Grosvenor Hotel. Include the roomNo in the output. Use 2019-01-21 as the current date.            (b) What is the total income from bookings for the Grosvenor Hotel today? Do this question for each of the hotels with 'Grosvenor' in name. Use 2019-01-21 as the...

  • Q) Integrity Constraints question. Consider following tables (bold are Primary Keys) •Hotel (hotelNo, hotelName, city) •Room...

    Q) Integrity Constraints question. Consider following tables (bold are Primary Keys) •Hotel (hotelNo, hotelName, city) •Room (roomNo, hotelNo, type, price) •Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) •Guest (guestNo, guestName, guestAddress) Identify the foreign keys in this schema, Explain how the entity and referential integrity rules apply to these relations.

  • ** Please use elational algebra expressions ** HOTEL (hotelNo, hotelName, city) ROOM (roomNo, hotelNo, type, price)...

    ** Please use elational algebra expressions ** HOTEL (hotelNo, hotelName, city) ROOM (roomNo, hotelNo, type, price) RESERVATION (hotelNo, guestNo, dateFrom, dateTo, roomNo) GUEST (guestNo, guestName, guestAddress) Consider the same schema from question 1 and express the following queries using relational algebra expressions: i) List the price and type of all rooms at the “Governor Hotel”. ii) List all guests who stayed at the “Governor Hotel” between 31st December 2018 (check-in) and 1stJanuary 2019 (check-out). iii) List all room numbers and...

  • **************PLEASE COMPLETE PART F) ONLY************** Consider the following relational database schema (primary keys are underlined) and...

    **************PLEASE COMPLETE PART F) ONLY************** Consider the following relational database schema (primary keys are underlined) and SQL query: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress) SELECT g.guestNo, g.guestName FROM Room r, Booking b, Hotel h, Guest g WHERE h.hotelNo = b.hotelNo AND g.guestNo = b.guestNo AND h.hotelNo = r.hotelNo AND h.hotelName = "Ritz" AND dateFrom >= "Jan 01, 2001" AND dateTo <= "Dec 31, 2001"; (A) state what...

  • **************PLEASE COMPLETE PART E) ONLY************** Consider the following relational database schema (primary keys are underlined) and...

    **************PLEASE COMPLETE PART E) ONLY************** Consider the following relational database schema (primary keys are underlined) and SQL query: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress) SELECT g.guestNo, g.guestName FROM Room r, Booking b, Hotel h, Guest g WHERE h.hotelNo = b.hotelNo AND g.guestNo = b.guestNo AND h.hotelNo = r.hotelNo AND h.hotelName = "Ritz" AND dateFrom >= "Jan 01, 2001" AND dateTo <= "Dec 31, 2001"; (A) state what...

  • Language SQL Need help with SQL Question Create a view vHW1_8_xxxx listing the guest name, number...

    Language SQL Need help with SQL Question Create a view vHW1_8_xxxx listing the guest name, number of days and the amount each guest needs to pay to the hotels for their stays. Your result should not include any unknown value in the dateto. Your result should include guest name, hotel name, number of days, and amount to pay. Here is my code: select guestname, hotelname, datediff(dateto,datefrom), sum(datediff(dateto,datefrom)*price) from Guest g, Hotel h, Room r, Booking b where h.hotelno=b.hotelno and r.roomno=b.roomno...

  • Need SQL form Thanks a lot EIERCISES lowing tables form part of a database held in...

    Need SQL form Thanks a lot EIERCISES lowing tables form part of a database held in a relational DBMS: Hote (Hotel_No, Name, Address) Roo (Room No, Hotel No. Tvpe. Price) Guest (Guest No, Name, Address) Room contains room details for each hotel and (Hotel_No, Room No) Boong Hotel No Ges, No, Date Fiom, Daie,To, RomNe) OOm where Hotel contains hotel details and Hotel No is the pri mary key forms the primary key -93

  • The following tables form part of a database held in a relational DBMS for University campuses:...

    The following tables form part of a database held in a relational DBMS for University campuses: -  Building (buildingNo , area)  ClassRoom (roomNo , buildingNo , capacity)  Reserving ( buildingNo , courseNo , timeFrom , day, roomNo)  Course (courseNo , courseName) Generate the tuple relational calculus, and domain relational calculus expressions for the following queries: 1. List all buildings. 2. List all class rooms in building 14Kh with capacity >30 students 3. List all course names,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT