Question: Answer the following questions based on the above database: (4 Points) Create a view named ATL_CHARTERS_V that includes the following For each charter of aircraft

 Answer the following questions based on the above database: (4 Points)

Answer the following questions based on the above database:

  1. (4 Points) Create a view named ATL_CHARTERS_V that includes the following For each charter of aircraft to Atlanta (STL), print the charter date, charter hours flown, and the corresponding customer last name, first name, area code, and phone number. Your answer should include both the SQL statement for view creating along with the contents of the view (you get the contents of the view by select * from ATL-CHARTERS_V).

  1. (4 Points) Modify the MODEL table to add the following attribute: (Note: use ALTER TABLE and UPDATE commands for this question.)

Attribute name

Attribute Description

Attribute type

MOD_LIFT_ WEIGHT

Amount of weight each model can lift

Numeric

Once the attribute has been added, update the values of all rows as per following values:

Attribute values for MOD_LIFT_WEIGHT

10,000 for Mod_code = DC-90A

5,000 for Mod_code = MA23-250

20,000 for Mod_code = PA31-950

  1. (4 Points) Create a trigger named trg_charter_hours that will automatically update the AIRCRAFT table after a new CHARTER row is added. Use the CHARTER tables CHAR_HOURS_FLOWN to update the AIRCRAFT tables AC_TTAF, AC_TTEL, and AC_TTER values.

The meaning for the AIRCRAFT table columns are as follows:

AC_TTAF: Total time on the air frame

AC_TTEL: Total time on the left engine (Also used to record single engine hours) AC_TTER: Total time on the right engine.

So in the trigger, you need to increase all of them with value of CHAR_HOURS_FLOWN

  1. (4 Points) Create a trigger named trg_cust_balance that will automatically update the AC_CUSTOMER tables CUS_BALANCE before a new CHARTER row is added. Use the CHARTER tables CHAR_TOT_CHG as the update source (Assume that all charter charges are charged to the customer balance.) In addition to the CHAR_TOT_CHG, add $25 for every quart of oil

used on the charter.

  1. (4 Points) Create a stored procedure to update model charge per mile attribute. Procedure takes the model number as a parameter. The procedure increases the charge for this model by 25%.

  1. (4 Points) Create a stored procedure that will take an Employee number and percentage, then update the corresponding employees hourly salary by the input percentage (increase the hourly salary, so you are giving the employee a raise).

Hint: Alter Employee table to add the hourly_salary field, update it with a value of 30 for all rows in the table, before creating the procedure.

able hame. CHARTER CHAR WAIT CHAR-TOT-CHO 10011Table name: EARNEDRATING RTG CODE EARNRTG DATE 0004 06-Feb-08 1484 10005 06-Feb-08 2288 0008 07-Feb-08 1484P 10009 07-Feb 8 220 0010 07-Feb-08 4278Y 0011 07-Feb-08 1484P NV ATL NA Table name: CREW Table name: CUSTOMER CUS ACODE I CUS 10011 Dunne 1285.19 Table name: RATING 442-3381 Certified Flight Instructor Certified Flight instructor,Instrument 10017 Wiiams George 10019 Smth 100Table name: EMPLOYEE Single Engine, Land Single Engine, Sea 19-Mar-196525-Apr-198 Table name: MODEL 14-Nov-1958 20-Dec-1992 16-ot-1974 28-Aug-2005.S0A Beechcrat MOO CODE MOO MANLFACTURER MOO NAME MOO SEATS MOO CHO MLE 08-Nov-197120-0ct-1996 PA23-250 Piper 4-Mar-197508-Jan-200 PA31-30 Ppe 12-Feb-1968 21Aug-1974 02--1996 14-Feb-1968 18-Jun-1961 14-Apr-1991 19-May-1970 01-Dec-1992 Table name: AIRCRAFT Table name: PILOT MOD CODE AC TTAF AC TTEL AC TTER EMP NUM PIL PL_AATIOS PL-MED-TYPE I PL-MED-DATE PL-PT135-DATE 7-Jan-08 778 9929 1513.1 COMMISELMELAnstr 10-Dec-07 able hame. CHARTER CHAR WAIT CHAR-TOT-CHO 10011Table name: EARNEDRATING RTG CODE EARNRTG DATE 0004 06-Feb-08 1484 10005 06-Feb-08 2288 0008 07-Feb-08 1484P 10009 07-Feb 8 220 0010 07-Feb-08 4278Y 0011 07-Feb-08 1484P NV ATL NA Table name: CREW Table name: CUSTOMER CUS ACODE I CUS 10011 Dunne 1285.19 Table name: RATING 442-3381 Certified Flight Instructor Certified Flight instructor,Instrument 10017 Wiiams George 10019 Smth 100Table name: EMPLOYEE Single Engine, Land Single Engine, Sea 19-Mar-196525-Apr-198 Table name: MODEL 14-Nov-1958 20-Dec-1992 16-ot-1974 28-Aug-2005.S0A Beechcrat MOO CODE MOO MANLFACTURER MOO NAME MOO SEATS MOO CHO MLE 08-Nov-197120-0ct-1996 PA23-250 Piper 4-Mar-197508-Jan-200 PA31-30 Ppe 12-Feb-1968 21Aug-1974 02--1996 14-Feb-1968 18-Jun-1961 14-Apr-1991 19-May-1970 01-Dec-1992 Table name: AIRCRAFT Table name: PILOT MOD CODE AC TTAF AC TTEL AC TTER EMP NUM PIL PL_AATIOS PL-MED-TYPE I PL-MED-DATE PL-PT135-DATE 7-Jan-08 778 9929 1513.1 COMMISELMELAnstr 10-Dec-07

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!