Question

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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear student, according to the question, the solution is as follows:

Given the relational tables:

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

The foreign keys can be identified if at all any attributes depend on the attribute of another relation/table.

1. For the Room table:

The hotelNo in the Room Table is a foreign key reference to hotelNo in the Hotel table.
i.e., We will get the Room in the hotel only when there exists a hotel. If there is no Hotel, How will be the room in the Hotel? Hence, It should be foreign key references to Hotel Table.  

2. For the Booking table:

hotelNo is foreign key references to hotelNo in the Hotel table,
i.e., We will book the Room in the hotel only when there exists a hotel. If there is no Hotel, How we will book the room in the Hotel? Hence, It should be foreign key references to Hotel Table.  

guestNo is foreign key references to guestNo in the Guest table
i.e., if, at all any guest books the room in the hotel, that information will be obtained from the Guest table. Hence, It should be foreign key references to Hotel Table.  

roomNo is foreign key references to roomNo in the Room table
i.e., We will book the Room in the hotel only when there exists a hotel. If there is no Hotel, How we will book the room in the Hotel? Hence, It should be foreign key references to Hotel Table.  

3. For the tables (Hotel and Guest), there are no foreign key references that refer to another table.

Thank you, All the best.

Add a comment
Know the answer?
Add Answer to:
Q) Integrity Constraints question. Consider following tables (bold are Primary Keys) •Hotel (hotelNo, hotelName, city) •Room...
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
  • 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...

  • ** 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...

  • 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...

  • 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....

  • **************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...

  • 2. The following tables form part of a database hield in a relatioual DBMS: (10 Points)...

    2. The following tables form part of a database hield in a relatioual DBMS: (10 Points) Hotel Room Booking Guest hotelNo, hotelName, city {room No. hotelNo. Type.price) booking No, hotelNo, guestNo, date from date To roomNo) (guestNo. guestName. guestAddress) A. List the price and type of all rooms at the Shangri-La Hotel B. Listall guests staying at Shangri-La Hotel berween Jimmy I and January 31, 2020 Liste details of all rooms at the Shangri-La llore, including the name of the...

  • 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...

  • a) Identify the foreign keys in this schema. Explain how the entity and referential integrity rules...

    a) Identify the foreign keys in this schema. Explain how the entity and referential integrity rules apply to these relations. b) Produce some sample tables for these relations that observe the relational in- tegrity rules. Suggest some general constraints that would be appropriate for this schema.

  • Given the following relational database schema (primary keys are bold and underlined). Answer questions 2.1 to 2.4 Orde...

    Given the following relational database schema (primary keys are bold and underlined). Answer questions 2.1 to 2.4 Orders(orderld, customerld, dateOrdered, dateRequired, status) Customer(customerld, customerLastName, customerStreet, customerCity, customerState, customer Lip OrderDetails(orderld.productld, quantity, lineNumber, amount) Products(productld, name, description, quantity, unitPrice) Account(accountNumber, customerld, dateOpened, creditCard, mailingStreet, mailingCity, mailingState, mailingZip) 2.1 (2 Points) List all possible foreign keys. For each foreign key list both the referencing and referenced relations. 2.2 (2 Points) Devise a reasonable database instance by filling the tables with data of...

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