Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How to do this Database questions using Oracle? Given the following Relations Schema: (Primary key column(s) are underlined, decide on the required foreign keys.) Hotel
How to do this Database questions using Oracle?
Given the following Relations Schema: (Primary key column(s) are underlined, decide on the required foreign keys.)
Hotel (hotelNo, hotelName, city)
Room (roomNo, hotelNo, type, price)
Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress)
1.. Write the DDL statement to remove all 4 tables, plus the OldBooking archive table.
[Hint: Take note of the deletion order of these tables; think about which ones should be deleted first.]
- Create the Hotel and Room tables with all relevant integrity constraints, including:
- type (Room table) must be one of Single, Double, or Family.
- price (Room table) must be between $10.00 and $100.00.
- room number (Room table) must be between 1 and 100.
- Create the Guest and Booking tables with all relevant integrity constraints.
- Insert 3 rows of sample data to each of the 4 tables. ([Hint: Note the foreign key requirements to determine which rows should be inserted first. Careful use of single quotes ' ' as appropriate.]
-
- The hotels now have a new room type 'Deluxe'. Modify the check constraint to allow for this.
- Need to offer discounts. Add column 'discount' to the Room table, with default value of 0 (percent), max. value of 30 (percent).
-
- One of the hotels (pick any one) increases the price of its 'Double' room type by 15%. Implement this change.
- One of the booking guest decided to arrive on an earlier date and stay till a later date. Modify the booking accordingly.
- Archiving old data from database table:
- Create an OldBooking table to archive / move data rows from the Booking table [Hint: Think carefully about needed and unnecessary constraints (PK, FKs, CHECK, etc.) for OldBooking.]
- Using the INSERT statement, copy the rows with dateTo before 2019-01-10 from the Booking table to the OldBooking archive table
- Then delete from Booking all booking rows with dateTo before 2019-01-10 (2 marks).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started