The business rules from the case study are;
Entities and attributes
Based on the business rules and the case study, the following entities with their attributes can be derived;
Entity relationship diagram
Table Name |
Attribute |
Attribute description |
Date type |
Date format |
range |
mandatory |
Primary key/ foreign key |
Foreign key reference table |
Flight |
FlightNO |
Unique value identifying a flight |
CHAR(5) |
F001 |
Y |
PK |
||
Date |
The date the flight is set to happen |
Date |
dd/mm/yyyy |
Y |
PK |
|||
departureTime |
The time will the plane will take off |
CHAR(10) |
12:00pm |
6-10 |
Y |
|||
arrivalTime |
The time the plane will land at the destination |
CHAR(10) |
02:00AM |
6-10 |
Y |
|||
pilotNO |
Unique identifier of the pilot who will fly the plane |
CHAR(4) |
E001 |
Y |
FK |
Pilot |
||
serialNO |
Unique identifier of the plane that will be used |
CHAR(4) |
A001 |
Y |
FK |
Airplane |
||
Passenger |
PasserngerNO |
Unique identifier of a passenger |
CHAR(4) |
P001 |
Y |
PK |
||
Name |
The names of a passenger |
VARCHAR(100) |
John Doe |
25-50 |
Y |
|||
Address |
The address of the passenger |
VARCHAR(250) |
1st street kings landing |
50-100 |
Y |
|||
telNO |
The tel of the passenger |
VARHCHAR(15) |
+ 23 23 323 |
10-15 |
Y |
|||
Flight_passengers |
passengerNO |
Unique identifier of the passenger in the flight |
CHAR(4) |
Y |
PK, FK |
Passenger |
||
flightNO |
Unique identifier of the flight |
CHAR(4) |
Y |
PK,FK |
Flight |
|||
flightDate |
Unique date of a flight |
PK,FK |
flight |
|||||
Fare |
The fare paid by the passenger |
DECIMAL |
100.99 |
Y |
P |
|||
reservationDate |
The date the passenger made a reservation |
date |
DD/MM/YYYY |
Y |
||||
Pilot |
PilotNO |
Unique identifier of a pilot |
CHAR(4) |
E001 |
Y |
PK |
||
firstName |
The first name of the pilot |
VARCHAR(50) |
John |
8-15 |
Y |
|||
lastName |
The last name of the pilot |
VARCHAR(50) |
Doe |
8-15 |
Y |
|||
dob |
The date of birth of the pilot |
Date |
DD/MM/YYYY |
Y |
||||
dateOfHire |
The date the pilot was hired |
date |
DD/MM/YYYY |
Y |
||||
Airplane |
serialNO |
Unique identifier of an airplane |
CHAR(4) |
A001 |
Y |
PK |
||
Model |
The model of the airplace |
VARCHAR(25) |
Boeing 737 F |
15-20 |
Y |
|||
Manufacturer |
Manufacturer name |
VARCHAR(50) |
Tesla Motors |
15-35 |
Y |
|||
yearBuilt |
The year the airplane was manufactured |
INTEGER(4) |
2005 |
4 |
Y |
|||
procedures |
procedureNO |
Unique identifier of a procedure |
CHAR(4) |
PR01 |
Y |
PK |
||
procedureName |
Name of the procedure |
VARCHAR(50) |
Engine checkup |
10-30 |
Y |
|||
frequency |
Frequency the procedure has to be done on a plane |
INTEGER(9) |
5 |
1-5 |
Y |
|||
Maintenance_event |
eventID |
Unique key identifying a maintenance event |
CHAR(4) |
M001 |
Y |
PK |
||
Location |
Location the maintenance event took place |
VARCHAR(25) |
Melbourne |
5-25 |
Y |
|||
Duration |
The duration in hours it took to complete the event |
INTEGER(5) |
24 |
N |
||||
procedureNO |
Foreign key referencing a unique procedure |
CHAR(4) |
Y |
FK |
Procedure |
|||
serialNO |
Foreign key referencing a unique plane |
CHAR(4) |
Y |
FK |
airplane |
Primary key: (flightNO, date)
Foreign key: pilotNO, serialNO
Normal Form:3NF
Primary key : (passengerNO)
Foreign key: None
Normal Form: 3NF
Primary key: (passengerNO, flightNO, date)
Foreign key: passengerNO, flightNO, date
Normal Form : 3NF
Primary key : ( pilotNO )
Foreign key : None
Normal Form : 3NF
Primary key : SerialNO
Foreign key: None
Normal Form: 3NF
Primary key: procedureNO
Foreign key: None
Normal form: 3NF
Primary key: eventID
Foreign key:procedureNO, serialNO
Normal Form: 3NF
SQL: DDL and DML statements
DDL
create table passenger(
passengerNO char(4) primary key,
name varchar(100) not null,
address varchar(250) not null,
telNO varchar(15) not null
);
pilotNO char(4) primary key,
firstName varchar(50) not null,
lastName varchar(50) not null,
dob date not null,
dateOfHire date not null
create table airplane (
serialNO char(4) primary key,
model varchar(25) not null,
manufatucturer varchar(50) not null,
yearBuilt integer(4) not null
create table procedures (
procedureNO char(4) primary key,
procedureName varchar(50) not null,
frequency integer(9) not null
create table flight(
flightNO char(4) not null,
flightDate date not null,
departureTime char(10) not null,
arrivalTime char(10) not null,
pilotNO char(4) not null,
serialNO char(4) not null,
primary key (flightNO,flightDate),
foreign key (pilotNO) references pilot (pilotNO),
foreign key (serialNO) references airplane (serialNO)
create table flight_passengers (
passengerNO char(4) not null,
flightNO char(4) not null,
flightDate date not null,
fare decimal not null,
reservationDate date not null,
primary key (passengerNO,flightNO,flightDate),
foreign key (passengerNO) references passenger (passengerNO),
foreign key (flightNO,flightDate) references flight (flightNO,flightDate)
create table maintenance_event (
eventID char(4) primary key,
location varchar(25) default ‘melbourne’ not null,
duration integer(5) not null,
procedureNO char(4) not null,
serialNO char(4) not null,
foreign key (procedureNO) references procedures (procedureNO),
foreign key (serialNO) references airplane (serialNO)
DML Scripts
INSERT INTO `airplane` (`serialNO`, `model`, `manufatucturer`, `yearBuilt`) VALUES
(‘A001’, ‘Boieng 737’, ‘Boieng’, 2012),
(‘A002’, ‘Airbus 3243’, ‘Airbus’, 2012),
(‘A003’, ‘Boeing 335’, ‘Boeing ‘, 2014)
INSERT INTO `passenger` (`passengerNO`, `name`, `address`, `telNO`) VALUES
(‘P001’, ‘Jon Snow’, ‘winterfell’, ‘+ 434 3434’),
(‘P002’, ‘Arya stark’, ‘winterfell’, ‘+34432 324324’),
(‘P003’, ‘Brianne of Tarth’, ‘kings landing’, ‘+3 433443’)
INSERT INTO `pilot` (`pilotNO`, `firstName`, `lastName`, `dob`, `dateOfHire`) VALUES
(‘E001’, ‘Peter’, ‘Griffin’, ‘2018-05-22’, ‘2019-02-23’),
(‘E002’, ‘Cleveland’, ‘Brown’, ‘2018-03-05’, ‘2018-09-11’),
(‘E003’, ‘Lois’, ‘Griffin’, ‘2012-03-05’, ‘2014-03-05’)
INSERT INTO `procedures` (`procedureNO`, `procedureName`, `frequency`) VALUES
(‘PR01’, ‘Engine checkup’, 36),
(‘PR02’, ‘Seats checkup’, 24),
(‘PR03’, ‘Pilot bay controls checkup’, 48);
INSERT INTO `flight` (`flightNO`, `flightDate`, `departureTime`, `arrivalTime`, `pilotNO`, `serialNO`) VALUES
(‘F001’, ‘2018-09-11′, ’10:00PM’, ‘)8:00AM’, ‘E001’, ‘A001’),
(‘F002’, ‘2018-09-18′, ’12:00AM’, ’12:00PM’, ‘E002’, ‘A002’),
(‘F003’, ‘2018-09-18′, ’03:00AM’, ’12:00PM’, ‘E003’, ‘A003’);
INSERT INTO `flight_passengers` (`passengerNO`, `flightNO`, `flightDate`, `fare`, `reservationDate`) VALUES
(‘P001’, ‘F001’, ‘2018-09-11’, ‘234’, ‘2018-09-12’),
(‘P002’, ‘F002’, ‘2018-09-18’, ‘433’, ‘2018-09-18’),
(‘P003’, ‘F003’, ‘2018-09-18’, ‘2434’, ‘2018-09-18’);
INSERT INTO `maintenance_event` (`eventID`, `location`, `duration`, `procedureNO`, `serialNO`) VALUES
(‘M001’, ‘melbourne’, 24, ‘PR01’, ‘A001’),
(‘M002’, ‘melbourne’, 45, ‘PR02’, ‘A002’),
(‘M003’, ‘melbourne’, 34, ‘PR03’, ‘A003’);
Default clause
Using default for a column means that the column will always have a default value during data insertion unless the default vaue is changed. From the database the location column in maintenance_events table is set to default meaning if it is not specified then the default value is inserted
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download