Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MySQL Trigger b) Write statement to create a trigger trgCheckSeats that will activate whenever a new row in being inserted into the Flight_Details table. The

image text in transcribed

MySQL Trigger b) Write statement to create a trigger trgCheckSeats that will activate whenever a new row in being inserted into the Flight_Details table. The maximum number of seats that a flight can contain is 150. The trigger should check for the value of seats being inserted. If it is more than 150, the INSERT operation is not allowed to succeed. Galaxy Airlines is a newly launched airlines service that operates flights to and from various cities all over Europe. To enable faster and efficient performance, galaxy Airlines has decided to incorporate use of triggers in their database applications. c) Write statements to create a trigger UpdateValid that will activate will a row is being updated in the Flight_Details table. The trigger should determine if the Seats column is present in the list of columns being updated. If yes, the Update Operation should not succeed because the Seats column is defined as a constant and cannot be changed The detailed list of operations to be performed are as follows: a) Create the following tables (Flight and Flight Details) in Galaxy Airlines database: Flight Table Field Name Data Type Key Field Description Aircraft_Code varchar(10) Primary key Stores aircraft code Source varchar(20) Stores the name of the city from where the aircraft will depart Stores the name of the city where the aircraft will arrive Destination varchar(20) Dep_Time varchar(10) Stores departure time Journey_hours int Stores journey hours Flight_Details Table Field Name Data Type Key Field Description Class_Code varchar(10) Primary key Stores the class whether busines or economy Aircraft_Code varchar(10) Foreign Key Stores aircraft code Fare money Stores the fare amount Seats int Stores total number of seats on the flight Note: Insert at least five records in each table. MySQL Trigger b) Write statement to create a trigger trgCheckSeats that will activate whenever a new row in being inserted into the Flight_Details table. The maximum number of seats that a flight can contain is 150. The trigger should check for the value of seats being inserted. If it is more than 150, the INSERT operation is not allowed to succeed. Galaxy Airlines is a newly launched airlines service that operates flights to and from various cities all over Europe. To enable faster and efficient performance, galaxy Airlines has decided to incorporate use of triggers in their database applications. c) Write statements to create a trigger UpdateValid that will activate will a row is being updated in the Flight_Details table. The trigger should determine if the Seats column is present in the list of columns being updated. If yes, the Update Operation should not succeed because the Seats column is defined as a constant and cannot be changed The detailed list of operations to be performed are as follows: a) Create the following tables (Flight and Flight Details) in Galaxy Airlines database: Flight Table Field Name Data Type Key Field Description Aircraft_Code varchar(10) Primary key Stores aircraft code Source varchar(20) Stores the name of the city from where the aircraft will depart Stores the name of the city where the aircraft will arrive Destination varchar(20) Dep_Time varchar(10) Stores departure time Journey_hours int Stores journey hours Flight_Details Table Field Name Data Type Key Field Description Class_Code varchar(10) Primary key Stores the class whether busines or economy Aircraft_Code varchar(10) Foreign Key Stores aircraft code Fare money Stores the fare amount Seats int Stores total number of seats on the flight Note: Insert at least five records in each table

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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

1. The evaluation results can be used to change the program.

Answered: 1 week ago

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago