Question
Write SQLs to create three tables based on given relational schemas and directions below. In addition, include the specifications below when you create the tables.
Write SQLs to create three tables based on given relational schemas and directions below.
In addition, include the specifications below when you create the tables.
(1) In FLIGHTLEG table, include following referential integrities. (1-1) When an AIRPORT record is deleted, the DepAirportCode and ArrAiportCode values of FLIGHTLEG records which refer the airport code of the deleted record will be changed to NULL. (1-2) When a FLIGHT record is deleted, all FLIGHTLEG records which refer the flight number of the deleted record will be also deleted. (2) In the Weekdays column of FLIGHT table, include a CHECK constraint for following. (2-1) The valid value of WEEKDAYS is one of {1, 2, 3, 4, 5} (3) In the AirportName column of AIRPORT table, include two constraints for following properties (3-1) required (NOT NULL) (3-2) candidate key (UNIQUE)
AIRPORT FLIGHTLEG FLIGHT PK Airportcode CHAR(3) Legno FlightNo NUMBER EEEEEE NUMBER NUMBER PK FK FlightNo City Airline VARCHAR2(30) CHAR(2) VARCHAR2(30) VARCHAR2(30) NUMBER State AirportName Weekdays DepTime ArrTime DepAirportCode ArrAirportCode DATE DATE CHAR(3) JCHAR(3)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