Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started