Please create this two trigger and write down as Mysql statement Create a trigger named trg_charter_time that will automatically update the AIRCRAFT table when a new CHARTER row is added. Use the...


Please create this two trigger and write down as Mysql statement



  • Create a trigger named trg_charter_time that will automatically update the AIRCRAFT table when a new CHARTER row is added. Use the CHARTER table’s CHAR_HOURS_FLOWN to update the AIRCRAFT table’s 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 (before maintenance)



AC_TTEL:Total time on the left engine (before maintenance, also track single engine)



AC_TTER:Total time on the right engine (before maintenance)



So in the trigger, you need to decrease all of them by the number of CHAR_HOUR_FLOWN




  • Create a trigger named trg_cust_charge that will automatically update the CUSTOMER table’s CUS_BALANCE when a new CHARTER row is added. Use the CHARTER table’s 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 a $5 service charge for every 50 miles flown.


Table name: CHARTER<br>Database name: Ch08_AviaCo<br>CHAR_TRIP CHAR DATE AC_NUMBER CHAR DESTINATION CHAR DISTANCE CHAR HOURS FLOWN CHAR HOURS WAIT CHAR_ FUEL GALLONS CHAR OIL QTS CUS_CODE<br>05-Feb-08 2289L.<br>Table name: EARNEDRATING<br>906<br>320<br>10001<br>ATL<br>5.1<br>22<br>354.1<br>1<br>10011<br>10002<br>05-Feb-08 2778V<br>BNA<br>1.6<br>726<br>10016<br>EMP_NUM RTG_CODE EARNRTG_DATE<br>10003 05-Feb-08 4278Y<br>GNV<br>1574<br>7.8<br>339.8<br>10014<br>101 CFI<br>18-Feb-98<br>10004 06-Feb-08 1484P<br>STL<br>472<br>2.9<br>4.9<br>97 2<br>10019<br>101 CFI<br>15-Dec-05<br>10005<br>06-Feb-08 2289L.<br>ATL<br>1023<br>5.7<br>3.5<br>397.7<br>2<br>10011<br>101 INSTR<br>08-Nov-93<br>10006 06-Feb-08 4278Y<br>STL<br>472<br>26<br>52<br>117.1<br>10017<br>101 MEL<br>23-Jun-94<br>21-Арг-93<br>15--96<br>10007 06-Feb-08 2778V<br>GNV<br>1574<br>7.9<br>348.4<br>2<br>10012<br>101 SEL<br>10008<br>07-Feb-08 1484P<br>TYS<br>644<br>4.1<br>140.6<br>10014<br>104 INSTR<br>10009<br>07-Feb-08 2289L<br>GNV<br>1574<br>6.6<br>23.4<br>4599<br>10017<br>104 MEL<br>29-Jan-97<br>12-Mar-95<br>104 SEL<br>105 CFI<br>10010<br>07-Feb-08 4278Y<br>ATL<br>998<br>6.2<br>3.2<br>279.7<br>10016<br>10011 07-Feb-08 1484P<br>BNA<br>352<br>1.9<br>5.3<br>66.4<br>10012<br>18-Nov-97<br>10012 08-Feb-08 2778V<br>MOB<br>884<br>4.8<br>4.2<br>215.1<br>10010<br>105 INSTR<br>17-Apr-95<br>12-Aug-95<br>23-Sep-94<br>10013<br>08-Feb-08 4278Y<br>TYS<br>644<br>3.9<br>4.5<br>1743<br>1<br>10011<br>105 MEL<br>10014<br>09-Feb-08 4278Y<br>ATL<br>936<br>6.1<br>2.1<br>3026<br>10017<br>105 SEL<br>10015<br>09-Feb-08 2289L<br>GNV<br>1645<br>6.7<br>4595<br>2<br>10016<br>106 INSTR<br>20-Dec-95<br>106 MEL<br>10016 09-Feb-08 2778V<br>10-Feb-08 1484P<br>02-Apr-96<br>10-Mar-94<br>MQY<br>312<br>1.5<br>67.2<br>10011<br>10017<br>STL<br>508<br>3.1<br>1055<br>10014<br>106 SEL<br>10018 10-Feb-08 4278Y<br>TYS<br>644<br>3.8<br>4.5<br>167.4<br>10017<br>109 CFI<br>05-Nov-98<br>109 CFI<br>21-Jun-03<br>Table name: CREW<br>Table name: CUSTOMER<br>23-Ju-96<br>15-Mar-97<br>109 INSTR<br>109 MEL<br>CUs CODE CUS LNAME CUS_FNAME CUS_NITIAL CUS AREACODE CUS_PHONE CUS_BALANCE<br>CHAR_TRIP<br>10001<br>EMP_NUM CREW_JOB<br>104 Plot<br>101 Plot<br>109 SEL<br>05-Feb-96<br>10010 Ramas<br>Alfred<br>A<br>615<br>844-2573<br>0.00<br>109 SES<br>12-May-96<br>10002<br>10011 Dunne<br>Leona<br>K<br>713<br>894-1238<br>0.00<br>10003<br>10003<br>10004<br>105 Plot<br>10012 Smith<br>Kathy<br>615<br>894-2285<br>896.54<br>109 Coplot<br>Table name: RATING<br>10013 Olowski<br>Paul<br>F<br>615<br>894-2180<br>1285.19<br>106 Plot<br>RTG CODE<br>10014 Orlando<br>222-1672<br>RTG_NAME<br>Myron<br>615<br>673.21<br>10005<br>101 Plot<br>10015 O'Brian<br>Amy<br>713<br>442-3381<br>1014.56<br>CFI<br>Certified Flight Instructor<br>Certified Flight Instructor, Instrument<br>10006<br>109 Pilot<br>10016 Brown<br>James<br>615<br>297-1228<br>00<br>10007<br>104 Plot<br>CFI<br>10017 Williams<br>George<br>615<br>290-2556<br>0.00<br>105 Copliot<br>106 Plot<br>10007<br>INSTR<br>Instrument<br>10018 Farriss<br>Anne<br>713<br>382-7185<br>0.00<br>10008<br>MEL<br>Multiengine Land<br>10019 Smith<br>Olette<br>K<br>615<br>297-3809<br>453.98<br>10009<br>105 Plot<br>SEL<br>Single Engine, Land<br>10010<br>108 Plot<br>Table name: EMPLOYEE<br>SES<br>Single Engine, Sea<br>10011<br>101 Plot<br>EMP DOB<br>15-Jun-1942<br>19-Mar-1965<br>14-Nov-1958<br>EMP_NUM EMP_TITLE EMP LNAME EMP_FNAME EMP_INTIAL<br>Kolmycz<br>10011<br>104 Coplot<br>EMP HRE DATE<br>10012<br>101 Plot<br>100 Mr<br>George<br>D<br>15-Mar-1987<br>10013<br>105 Pilot<br>101 Ms.<br>Lewis<br>Rhonda<br>G<br>25-Apr-1988 Table name: MODEL<br>10014<br>106 Plot<br>102 Mr.<br>Vandam<br>Rhett<br>20-Dec-1992<br>MOD_CODE MOD MANUFACTURER<br>MOD_NAME<br>MOD_SEATS MOD_CHO MILE<br>10015<br>101 Coplot<br>103 Ms.<br>28-Aug-2005<br>20-Oct-1996<br>Jones<br>Anne<br>16-Oct-1974<br>10015<br>104 Plot<br>C-90A<br>Beechcraft<br>KingAir<br>8<br>2.67<br>104 Mr.<br>Lange<br>John<br>08-Nov-1971<br>PA23-250 Piper<br>08-Jan-2006 PA31-350 Piper<br>Aztec<br>6<br>1.93<br>10016<br>105 Copilot<br>109 Plot<br>105 Mr.<br>Williams<br>Robert<br>D<br>14-Mar-1975<br>12-Feb-1968<br>21-Aug-1974<br>10016<br>Navajo Chieftain<br>10<br>2.35<br>106 Mrs<br>Duzak<br>Jeanine<br>K<br>05-Jan-1991<br>10017<br>101 Plot<br>107 Mr.<br>Diante<br>Jorge<br>D<br>02-Jul-1996<br>10018<br>104 Coplot<br>108 Mr.<br>Wiesenbach Paul<br>14-Feb-1966<br>18-Nov-1994<br>10018<br>105 Pilot<br>18-Jun-1961<br>14-Apr-1991<br>01-Dec-1992<br>109 Ms<br>Travis<br>Elizabeth<br>110 Mrs.<br>Genkazi<br>Leighla<br>19-May-1970<br>Table name: AIRCRAFT<br>AC_NUMBER MOD_CODE AC_TTAF<br>Table name: PILOT<br>EMP_NUM PIL_LICENSE<br>AC_TTEL AC_TTER<br>PL_MED_TYPE PL_MED_DATE PL_PT135_DATE<br>11-Jan-08<br>PIL_RATINGS<br>1484P<br>PA23-250<br>1833.1<br>1833.1<br>101.8<br>101 ATP<br>ATP/SELMELAnstr/CFI<br>1<br>20-Jan-08<br>2269L<br>C-90A<br>4243.8<br>768.9<br>1123.4<br>104 ATP<br>ATP/SELMELAnstr<br>1<br>18-Dec-07<br>17-Jan-03<br>2778V<br>PA31-350<br>7992.9<br>1513.1<br>789.5<br>105 COM<br>COMM/SELMELAnstr/CFI<br>2<br>05-Jan-08<br>02-Jan-08<br>4278Y<br>PA31-350<br>2147.3<br>622.1<br>243.2<br>COMM/SELMELAnstr<br>ATP/SELMELSESAnstr/CFI 1<br>106 COM<br>2<br>10-Dec-07<br>02-Feb-08<br>109 COM<br>22-Jan-08<br>15-Jan-08<br>

Extracted text: Table name: CHARTER Database name: Ch08_AviaCo CHAR_TRIP CHAR DATE AC_NUMBER CHAR DESTINATION CHAR DISTANCE CHAR HOURS FLOWN CHAR HOURS WAIT CHAR_ FUEL GALLONS CHAR OIL QTS CUS_CODE 05-Feb-08 2289L. Table name: EARNEDRATING 906 320 10001 ATL 5.1 22 354.1 1 10011 10002 05-Feb-08 2778V BNA 1.6 726 10016 EMP_NUM RTG_CODE EARNRTG_DATE 10003 05-Feb-08 4278Y GNV 1574 7.8 339.8 10014 101 CFI 18-Feb-98 10004 06-Feb-08 1484P STL 472 2.9 4.9 97 2 10019 101 CFI 15-Dec-05 10005 06-Feb-08 2289L. ATL 1023 5.7 3.5 397.7 2 10011 101 INSTR 08-Nov-93 10006 06-Feb-08 4278Y STL 472 26 52 117.1 10017 101 MEL 23-Jun-94 21-Арг-93 15--96 10007 06-Feb-08 2778V GNV 1574 7.9 348.4 2 10012 101 SEL 10008 07-Feb-08 1484P TYS 644 4.1 140.6 10014 104 INSTR 10009 07-Feb-08 2289L GNV 1574 6.6 23.4 4599 10017 104 MEL 29-Jan-97 12-Mar-95 104 SEL 105 CFI 10010 07-Feb-08 4278Y ATL 998 6.2 3.2 279.7 10016 10011 07-Feb-08 1484P BNA 352 1.9 5.3 66.4 10012 18-Nov-97 10012 08-Feb-08 2778V MOB 884 4.8 4.2 215.1 10010 105 INSTR 17-Apr-95 12-Aug-95 23-Sep-94 10013 08-Feb-08 4278Y TYS 644 3.9 4.5 1743 1 10011 105 MEL 10014 09-Feb-08 4278Y ATL 936 6.1 2.1 3026 10017 105 SEL 10015 09-Feb-08 2289L GNV 1645 6.7 4595 2 10016 106 INSTR 20-Dec-95 106 MEL 10016 09-Feb-08 2778V 10-Feb-08 1484P 02-Apr-96 10-Mar-94 MQY 312 1.5 67.2 10011 10017 STL 508 3.1 1055 10014 106 SEL 10018 10-Feb-08 4278Y TYS 644 3.8 4.5 167.4 10017 109 CFI 05-Nov-98 109 CFI 21-Jun-03 Table name: CREW Table name: CUSTOMER 23-Ju-96 15-Mar-97 109 INSTR 109 MEL CUs CODE CUS LNAME CUS_FNAME CUS_NITIAL CUS AREACODE CUS_PHONE CUS_BALANCE CHAR_TRIP 10001 EMP_NUM CREW_JOB 104 Plot 101 Plot 109 SEL 05-Feb-96 10010 Ramas Alfred A 615 844-2573 0.00 109 SES 12-May-96 10002 10011 Dunne Leona K 713 894-1238 0.00 10003 10003 10004 105 Plot 10012 Smith Kathy 615 894-2285 896.54 109 Coplot Table name: RATING 10013 Olowski Paul F 615 894-2180 1285.19 106 Plot RTG CODE 10014 Orlando 222-1672 RTG_NAME Myron 615 673.21 10005 101 Plot 10015 O'Brian Amy 713 442-3381 1014.56 CFI Certified Flight Instructor Certified Flight Instructor, Instrument 10006 109 Pilot 10016 Brown James 615 297-1228 00 10007 104 Plot CFI 10017 Williams George 615 290-2556 0.00 105 Copliot 106 Plot 10007 INSTR Instrument 10018 Farriss Anne 713 382-7185 0.00 10008 MEL Multiengine Land 10019 Smith Olette K 615 297-3809 453.98 10009 105 Plot SEL Single Engine, Land 10010 108 Plot Table name: EMPLOYEE SES Single Engine, Sea 10011 101 Plot EMP DOB 15-Jun-1942 19-Mar-1965 14-Nov-1958 EMP_NUM EMP_TITLE EMP LNAME EMP_FNAME EMP_INTIAL Kolmycz 10011 104 Coplot EMP HRE DATE 10012 101 Plot 100 Mr George D 15-Mar-1987 10013 105 Pilot 101 Ms. Lewis Rhonda G 25-Apr-1988 Table name: MODEL 10014 106 Plot 102 Mr. Vandam Rhett 20-Dec-1992 MOD_CODE MOD MANUFACTURER MOD_NAME MOD_SEATS MOD_CHO MILE 10015 101 Coplot 103 Ms. 28-Aug-2005 20-Oct-1996 Jones Anne 16-Oct-1974 10015 104 Plot C-90A Beechcraft KingAir 8 2.67 104 Mr. Lange John 08-Nov-1971 PA23-250 Piper 08-Jan-2006 PA31-350 Piper Aztec 6 1.93 10016 105 Copilot 109 Plot 105 Mr. Williams Robert D 14-Mar-1975 12-Feb-1968 21-Aug-1974 10016 Navajo Chieftain 10 2.35 106 Mrs Duzak Jeanine K 05-Jan-1991 10017 101 Plot 107 Mr. Diante Jorge D 02-Jul-1996 10018 104 Coplot 108 Mr. Wiesenbach Paul 14-Feb-1966 18-Nov-1994 10018 105 Pilot 18-Jun-1961 14-Apr-1991 01-Dec-1992 109 Ms Travis Elizabeth 110 Mrs. Genkazi Leighla 19-May-1970 Table name: AIRCRAFT AC_NUMBER MOD_CODE AC_TTAF Table name: PILOT EMP_NUM PIL_LICENSE AC_TTEL AC_TTER PL_MED_TYPE PL_MED_DATE PL_PT135_DATE 11-Jan-08 PIL_RATINGS 1484P PA23-250 1833.1 1833.1 101.8 101 ATP ATP/SELMELAnstr/CFI 1 20-Jan-08 2269L C-90A 4243.8 768.9 1123.4 104 ATP ATP/SELMELAnstr 1 18-Dec-07 17-Jan-03 2778V PA31-350 7992.9 1513.1 789.5 105 COM COMM/SELMELAnstr/CFI 2 05-Jan-08 02-Jan-08 4278Y PA31-350 2147.3 622.1 243.2 COMM/SELMELAnstr ATP/SELMELSESAnstr/CFI 1 106 COM 2 10-Dec-07 02-Feb-08 109 COM 22-Jan-08 15-Jan-08
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here