Answered step by step
Verified Expert Solution
Link Copied!

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

  1. Create the Hotel and Room tables with all relevant integrity constraints, including:
    1. type (Room table) must be one of Single, Double, or Family.
    2. price (Room table) must be between $10.00 and $100.00.
    3. room number (Room table) must be between 1 and 100.

  1. Create the Guest and Booking tables with all relevant integrity constraints.

  1. 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.]
    1. The hotels now have a new room type 'Deluxe'. Modify the check constraint to allow for this.
    2. Need to offer discounts. Add column 'discount' to the Room table, with default value of 0 (percent), max. value of 30 (percent).
    1. One of the hotels (pick any one) increases the price of its 'Double' room type by 15%. Implement this change.
    2. One of the booking guest decided to arrive on an earlier date and stay till a later date. Modify the booking accordingly.

  1. Archiving old data from database table:
    1. 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.]
    2. Using the INSERT statement, copy the rows with dateTo before 2019-01-10 from the Booking table to the OldBooking archive table
    3. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions