The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 407 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Exercise 6Create 2 tables, LAB7_RESERVATIONS table with 2 columns:Name Null Type---------- ------------- ---------------FLIGHT_ID NOT NULL CHAR(6)CUSTOMER_PHONE NOT NULL NUMBERand LAB7_FLIGHTS table with 2 columns:FLIGHT_ID NOT NULL CHAR(6)SEATS NOT NULL NUMBERMake FLIGHT_ID the primary key in the LAB7_FLIGHTS table.Insert the following rows into LAB7_FLIGHTS: COSC 304 – Lab 7 (Triggers) Page 7FLIGHT_ID SEATSAC0529 120AC0530 0Create a trigger LAB7_RES_TRG that will ensure that when a new row is inserted into theLAB7_RESERVATIONS table, the flight id is in the LAB7_FLIGHTS table and that the numberof seats on this flight, SEATS is greater than 0. Here are the details of how the trigger shouldbehave: 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 raiseapplication 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 inflights table by setting SEATS = SEATS – 1 for this flight.(Hint: Use the PL/SQL statement select .. into .. )
Â
Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- Th-----------ank----------- Yo-----------u f-----------or -----------usi-----------ng -----------our----------- we-----------bsi-----------te -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill-----------