Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help fill out the rest of the MySQL trigger so that the maximum number of flight legs (leg_no in the FLIGHT_LEG) cannot exceed 4. CREATE

Help fill out the rest of the MySQL trigger so that the maximum number of flight legs (leg_no in the FLIGHT_LEG) cannot exceed 4.

CREATE TRIGGER maxFlightLegCheck BEFORE INSERT ON `FLIGHT_LEG`

FOR EACH ROW

BEGIN

DECLARE V_COUNT INT;

SELECT COUNT(FLIGHT_LEG.Leg_no) INTO V_COUNT FROM FLIGHT JOIN ...

IF (V_COUNT > 4)

THEN

SIGNAL SQLSTATE '02000'

SET MESSAGE_TEXT = 'Warning: Max amount of flight legs is 4.';

END IF;

END

image text in transcribed

AIRPORT FLIGHT LEG Leg_no INT City VARCHAR(45) State VARCHAR(45) Scheduled_arr_time TIME Scheduled_dep_tme TIME FLIGHT Num ber INT Airline VARCHAR(45) Name VARCHAR(45) AIRPORT-Airport Code VARGAR (45) Weekdays VARCHAR(45) FLIGHT Number INT FARE Code INT Amount DECIMAL(7,2) LEG_INSTANCE CAN_LAND AIRPORT_Airport_code VARCHAR (45) AIRPLANE TYPE Type name VARCHAR(45) Noofavail seats INT - - Date DATE FLIGHT_LEG Leg_no INT AIRPLANE_Airplane id INT Arr-time TIME Dep time TIME AIRPORT, Airport_code VARAR(45) Restrictions VARCHAR(45) FLIGHT Number INT AIRPLANETYPE - Company VARCHAR(45) ?Type_name VARCHAR(45) Max_seats INT SEAT Seat no INT Custom er_name VARCHAR(45) Cphone BIGINT(10) LEG_INSTANCE Date DATE AIRPLANE Airplane_id INT Total_no of_seats INT AIRPLANE, TYPE Typename VARCHAR(45)

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_2

Step: 3

blur-text-image_3

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago