Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions 1. For each table, append your student id along with the table name. For e.g. employee_student id (employee_T16363737) 2. Submit assignment in pdf format.

image text in transcribed

Instructions 1. For each table, append your student id along with the table name. For e.g. employee_student id (employee_T16363737) 2. Submit assignment in pdf format. 3. Format for questions: a. Question b. PL/ SQL solution or code c. Screenshot for output

Q2. Create 2 tables, LAB7_RESERVATIONS table with 2 columns Name Null Type FLIGHT ID NOT NULL CHAR(6) CUSTOMER PHONE NOT NULL NUMBER and LAB7_FLIGHTS table with 2 columns: FLIGHT_ID SEATS NOT NULL NOT NULL CHAR(6) NUMBER Make FLIGHT_ID the primary key in the LAB7_FLIGHTS table, Insert the following rows into LAB7_FLIGHTS: FLIGHT ID SEATS AC0529 120 AC0530 0 Create a trigger LAB7_RES_TRG that will ensure that when a new row is inserted into the LAB7_RESERVATIONS table, the flight id is in the LAB7_FLIGHTS table and that the number of seats on this flight, SEATS is greater than 0. Here are the details of how the trigger should behave: If flight id is not in the flights table it should raise application error 'Invalid flight id' If flight id is in the flights table. (for example AC0529) but SEATS = 0, then it should raise application error 'Flight AC0529 has no seats left If flight id is in the flights table and SEATS > 0, then it should update the appropriate row in flights table by setting SEATS = SEATS - 1 for this flight Q2. Create 2 tables, LAB7_RESERVATIONS table with 2 columns Name Null Type FLIGHT ID NOT NULL CHAR(6) CUSTOMER PHONE NOT NULL NUMBER and LAB7_FLIGHTS table with 2 columns: FLIGHT_ID SEATS NOT NULL NOT NULL CHAR(6) NUMBER Make FLIGHT_ID the primary key in the LAB7_FLIGHTS table, Insert the following rows into LAB7_FLIGHTS: FLIGHT ID SEATS AC0529 120 AC0530 0 Create a trigger LAB7_RES_TRG that will ensure that when a new row is inserted into the LAB7_RESERVATIONS table, the flight id is in the LAB7_FLIGHTS table and that the number of seats on this flight, SEATS is greater than 0. Here are the details of how the trigger should behave: If flight id is not in the flights table it should raise application error 'Invalid flight id' If flight id is in the flights table. (for example AC0529) but SEATS = 0, then it should raise application error 'Flight AC0529 has no seats left If flight id is in the flights table and SEATS > 0, then it should update the appropriate row in flights table by setting SEATS = SEATS - 1 for this flight

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

How To Audit Anything The Pink Book Of Auditing Any Process

Authors: R. Alakbarov

1st Edition

1520195575, 978-1520195575

More Books

Students also viewed these Accounting questions

Question

What is the relationship between humans?

Answered: 1 week ago

Question

What is the orientation toward time?

Answered: 1 week ago