SlideShare a Scribd company logo
Air India Database Design
DBMS (CSN-351)
Group Number - 1
Abhishek Jaisingh 14114002
Amandeep 14114008
Tirth Patel 14114036
​Table of Contents
ER Diagram 2
Assumptions 2
Initial Schema Diagram 3
Tables with FDs 4
Final Schema Diagram 8
Basic Operations with SQL queries and results 9
1
ER diagram
Assumptions
1. There is a route code table not listed as separate table in our design, which has
information about all the intermediate airports in a journey with specific route code.
2. A person can only book 1 ticket per transaction. A new transaction is required again to
book more tickets.
3. Fare for the each flight in AirFare table is calculated separately using the Route of the
flight.
2
Initial Schema diagram
3
Tables with functional dependencies
Country [BCNF]
Primary Key: CtID
CtID → CountryName
CREATE TABLE ​`Country`
(
`CtID`​ INT NOT NULL AUTO_INCREMENT,
`CountryName`​ varchar​(​32​)​ NOT NULL,
PRIMARY KEY ​(​`CtID`)
);
State [BCNF]
Primary Key: StID
StID → StateName | Country
CREATE TABLE ​`State`
(
`StID`​ INT NOT NULL AUTO_INCREMENT UNIQUE,
`StateName`​ varchar​(​32​)​ NOT NULL,
`Country`​ INT NOT NULL,
PRIMARY KEY ​(​`StID`​),
FOREIGN KEY ​(​`Country`​)​ REFERENCES ​`Country`​(​`CtID`)
);
Contact_Details [BCNF]
Primary Key: CnID
CnID → Email | Mobile | State
CREATE TABLE ​`Contact_Details`
(
`CnID`​ INT NOT NULL AUTO_INCREMENT,
`Email`​ varchar​(​50​)​ NOT NULL,
`Mobile`​ varchar​(​16​)​ NOT NULL,
`State`​ INT NOT NULL,
PRIMARY KEY ​(​`CnID`​),
FOREIGN KEY ​(​`State`​)​ REFERENCES ​`State`​(​`StID`)
4
);
Passenger [BCNF]
Primary Key: PsID
PsID → Name | Address | Age | Nationality | Contacts
CREATE TABLE ​`Passenger`
(
`PsID`​ INT NOT NULL AUTO_INCREMENT,
`Name`​ varchar​(​32​)​ NOT NULL,
`Address`​ varchar​(​64​)​ NOT NULL,
`Age`​ INT NOT NULL,
`Nationality`​ varchar​(​16​)​ NOT NULL,
`Contacts`​ INT NOT NULL,
PRIMARY KEY ​(​`PsID`​),
FOREIGN KEY ​(​`Contacts`​)​ REFERENCES ​`Contact_Details`​(​`CnID`)
);
Transaction [BCNF]
Primary Key: TsID
TsID → BookingDate | Passenger | Flight
CREATE TABLE ​`Transaction`
(
`TsID`​ INT NOT NULL AUTO_INCREMENT,
`BookingDate`​ DATETIME NOT NULL,
`Passenger`​ INT NOT NULL,
`Flight`​ INT NOT NULL,
PRIMARY KEY ​(​`TsID`​),
FOREIGN KEY ​(​`Passenger`​)​ REFERENCES ​`Passenger`​(​`PsID`​),
FOREIGN KEY ​(​`Flight`​)​ REFERENCES ​`Flight_Schedule`​(​`FlID`)
);
Flight_Schedule [2NF]
Primary Key: FlID
FlID → FlightDate | Departure | Arrival | AirCraft | NetFare
Departure → FlightDate
5
CREATE TABLE ​`Flight_Schedule`
(
`FlID`​ INT NOT NULL AUTO_INCREMENT,
`FlightDate`​ DATE NOT NULL,
`Departure`​ DATETIME NOT NULL,
`Arrival`​ DATETIME NOT NULL,
`AirCraft`​ INT NOT NULL,
`NetFare`​ INT NOT NULL,
PRIMARY KEY ​(​`FlID`​),
FOREIGN KEY ​(​`AirCraft`​)​ REFERENCES ​`AirCraft`​(​`AcID`​),
FOREIGN KEY ​(​`NetFare`​)​ REFERENCES ​`AirFare`​(​`AfID`)
);
Note : This table is in 2NF due to the derivation of FlightDate from Departure attribute
which is trivial. Removing this dependency by adding extra table only for FlightDate
enhances the overhead for queries. Keeping it in this form results in very little reduction
in memory efficiency.
AirFare [BCNF]
Primary Key: AfID
AfID → Route | Fare
CREATE TABLE ​`AirFare`
(
`AfID`​ INT NOT NULL AUTO_INCREMENT,
`Route`​ INT NOT NULL,
`Fare`​ INT NOT NULL,
PRIMARY KEY ​(​`AfID`​),
FOREIGN KEY ​(​`Route`​)​ REFERENCES ​`Route`​(​`RtID`)
);
Route [BCNF]
Primary Key: RtID
RtID → Airport | Destination | RouteCode
CREATE TABLE ​`Route`
(
`RtID`​ INT NOT NULL AUTO_INCREMENT,
`Airport`​ varchar​(​32​)​ NOT NULL,
`Destination`​ varchar​(​32​)​ NOT NULL,
`RouteCode`​ varchar​(​16​)​ NOT NULL UNIQUE,
PRIMARY KEY ​(​`RtID`)
6
);
Note : Here RouteCode will be is unique number recognizing the route of the flight
between given 2 airports.
AirCraft [2NF]
Primary Key: AcID
AcID → Ac_Type | Capacity | Mfg_Date
Ac_Type → Capacity
Note : To convert into ​BCNF​, this table is decomposed into 2 new following tables
AirCraft​ and ​AirCraft_Type​.
AirCraft [BCNF] (from decomposition)
Primary Key: AcID
AcID → Ac_Type | Ac_Type | Mfg_Date
CREATE TABLE ​`AirCraft`
(
`AcID`​ INT NOT NULL AUTO_INCREMENT,
`Ac_Type`​ INT NOT NULL,
`Mfg_Date`​ DATE NOT NULL,
PRIMARY KEY ​(​`AcID`​),
FOREIGN KEY ​(​`Ac_Type`​)​ REFERENCES ​`AirCraft_Type`​(​`ActID`)
);
AirCraft_Type [BCNF] (from decomposition)
Primary Key: ActID
ActID → Type | Capacity
CREATE TABLE ​`AirCraft_Type`
(
`ActID`​ INT NOT NULL AUTO_INCREMENT,
`Type`​ varchar​(​32​)​ NOT NULL,
`Capacity`​ INT NOT NULL,
PRIMARY KEY ​(​`ActID`)
);
7
Final Schema Diagram
This is final schema diagram after decomposition. These 10 tables are made in our Air India
database design.
8
Basic Operations
Here are some basic operations listed that our database provides. Each functionality is shown
with corresponding sample SQL query and screenshot.
1. List all the aircrafts older than '2' years (can be used for expiry dates or
maintenance date)
SELECT ​AcID​,​ ​Mfg_Date​,​ ​Type
FROM ​AirCraft​ INNER JOIN ​AirCraft_Type​ ON ​(​AirCraft​.​Ac_Type​ ​=​ ​AirCraft_Type​.​ActID​)
WHERE YEAR​(​CURDATE​())​ ​-​ YEAR​(​Mfg_Date​)​ ​>​ 2
2. List all the flights in database from airport 'New Delhi' to airport 'Bangalore'
SELECT ​FlId​,​ ​FlightDate​,​ ​Fare​,​ ​Departure​,​ ​Arrival
FROM ​((​Flight_Schedule​ INNER JOIN ​AirFare​ ON ​(​Flight_Schedule​.​NetFare​ ​=​ ​AirFare​.​AfID​)))
INNER JOIN ​Route​ ON ​(​Route​ ​=​ ​RtID​)
WHERE ​Airport​ ​=​ ​'New Delhi'​ AND ​Destination​ ​=​ ​'Bangalore'
9
3. List all the passengers for flight no. '5'
SELECT NAME​,​ ​Age​,​ ​Mobile
FROM ​Transaction​ INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​)
INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​)
WHERE ​Flight​ ​=​ ​5
ORDER BY NAME
4. List all the minor (age less than 18) travelling in flight no. '5'
SELECT ​Name​,​ ​Age​,​ ​Mobile​,​ ​Address​,​ ​StateName​,​ ​CountryName
FROM ​Transaction​ INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​)
INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​)
INNER JOIN ​State​ ON ​(​State​ ​=​ ​StID​)
INNER JOIN ​Country​ ON ​(​CtID​ ​=​ ​Country)
WHERE ​Flight​ ​=​ ​5​ AND ​Age​ ​<​ ​18
ORDER BY NAME​,​ ​Age
10
5. Total Fare collected from date '2016-10-01' to date '2016-10-20'
SELECT SUM​(​Fare​)
FROM ​Transaction​ INNER JOIN ​Flight_Schedule​ ON ​(​Flight​ ​=​ ​FlID​)
INNER JOIN ​AirFare​ ON ​(​NetFare​ ​=​ ​AfID​)
WHERE DATE ​(​BookingDate​)​ BETWEEN ​'2016-10-01'​ AND ​'2016-10-20'
6. Total number of tickets booked from date '2016-10-10' to date '2016-11-25'
SELECT COUNT​(​PsID​)​ AS ​Tickets
FROM ​Transaction​ INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​)
INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​)
WHERE DATE ​(​BookingDate​)​ BETWEEN ​'2016-10-10'​ AND ​'2016-11-25';
7. Number of persons travelling airport 'New Delhi' from date '2016-11-1' to date
'2016-11-30'
SELECT COUNT​(​PsID​)​ AS NUM_CUSTOMERS
FROM ​Route​ INNER JOIN ​AirFare​ ON ​(​RtID​ ​=​ ​Route​)
INNER JOIN ​Flight_Schedule​ ON ​(​AfID​ ​=​ ​NetFare​)
INNER JOIN ​Transaction​ ON ​(​Flight​ ​=​ ​FlID​)
INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​)
INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​)
WHERE DATE ​(​FlightDate​)​ BETWEEN ​'2016-11-1'​ AND ​'2016-11-30'​ AND ​Airport​ ​=​ ​'New Delhi';
11
8. Number of persons reaching at 'New Delhi' from date '2016-11-1' to date
'2016-11-30'
SELECT COUNT​(​PsID​)​ AS NUM_CUSTOMERS
FROM ​Route​ INNER JOIN ​AirFare​ ON ​(​RtID​ ​=​ ​Route​)
INNER JOIN ​Flight_Schedule​ ON ​(​AfID​ ​=​ ​NetFare​)
INNER JOIN ​Transaction​ ON ​(​Flight​ ​=​ ​FlID​)
INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​)
INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​)
WHERE DATE ​(​FlightDate​)​ BETWEEN ​'2016-11-1'​ AND ​'2016-11-30'​ AND ​Destination​ ​=​ ​'New Delhi';
9. Number of persons with flights from 'New Delhi' to 'Bangalore' from date
'2016-11-1' to date '2016-11-30'
SELECT COUNT​(​PsID​)​ AS NUM_CUSTOMERS
FROM ​Route​ INNER JOIN ​AirFare​ ON ​(​RtID​ ​=​ ​Route​)
INNER JOIN ​Flight_Schedule​ ON ​(​AfID​ ​=​ ​NetFare​)
INNER JOIN ​Transaction​ ON ​(​Flight​ ​=​ ​FlID​)
INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​)
INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​)
WHERE DATE ​(​FlightDate​)​ BETWEEN ​'2016-11-1'​ AND ​'2016-11-30'​ AND ​Airport​ ​=​ ​'New Delhi'
AND ​Destination​ ​=​ ​'Bangalore';
10. Provide State wise analysis of sales of flight tickets
SELECT ​StateName​,​ ​Count​(​PsID​)​ AS ​Tickets
FROM ​Transaction​ INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​)
INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​)
INNER JOIN ​State​ ON ​(​State​ ​=​ ​StID​)
GROUP BY ​StateName
ORDER BY ​Count​(​PsID​)​ DESC;
12
13

More Related Content

What's hot

Airline reservation system
Airline reservation systemAirline reservation system
Airline reservation system
Unsa Jawaid
 
Air line reservation system software engeniring
Air line reservation system software engeniringAir line reservation system software engeniring
Air line reservation system software engeniring
Asfand Sheraz Khan Niazi
 
Airline ticket reservation system
Airline ticket reservation systemAirline ticket reservation system
Airline ticket reservation system
SH Rajøn
 
Online Airway Reservation System
Online Airway Reservation SystemOnline Airway Reservation System
Online Airway Reservation System
Hari Wiz
 
Airline Management System [for presentation]
Airline Management System [for presentation]Airline Management System [for presentation]
Airline Management System [for presentation]
SH Rajøn
 
Airline Reservation System
Airline Reservation SystemAirline Reservation System
Airline Reservation System
Sahil Talwar
 
Airline Reservation System - Software Engineering
Airline Reservation System - Software EngineeringAirline Reservation System - Software Engineering
Airline Reservation System - Software Engineering
Drishti Bhalla
 
Airline reservation system project report (1)
Airline reservation system project report (1)Airline reservation system project report (1)
Airline reservation system project report (1)
MostafaMorsyMohamed
 
SRS on airline reservation system
SRS on airline reservation system SRS on airline reservation system
SRS on airline reservation system
VikasSingh958
 
Presentation On Online Airline Ticket Booking Project Planning
Presentation On Online Airline Ticket Booking Project PlanningPresentation On Online Airline Ticket Booking Project Planning
Presentation On Online Airline Ticket Booking Project Planning
Rajon
 
Design and implementation of airline flight information system
Design and implementation of airline flight information systemDesign and implementation of airline flight information system
Design and implementation of airline flight information system
EMMANUEL FRESHMAN
 
Air ticket reservation_system_presentati
Air ticket reservation_system_presentatiAir ticket reservation_system_presentati
Air ticket reservation_system_presentati
EPHRAIMDUAHOWUSU
 
Airline Reservation System
Airline Reservation SystemAirline Reservation System
Airline Reservation System
Arohi Khandelwal
 
Airline reservation system
Airline reservation system Airline reservation system
Airline reservation system
krishnayadav962132
 
Airline reservation system
Airline reservation systemAirline reservation system
Airline reservation system
aswath babu
 
Flight reservation and ticketing system ppt
Flight reservation and ticketing system pptFlight reservation and ticketing system ppt
Flight reservation and ticketing system pptmarcorelano
 
Airline management system
Airline management systemAirline management system
Airline management system
SH Rajøn
 
construction of Reservation software solution for Airline Companies project ...
construction of  Reservation software solution for Airline Companies project ...construction of  Reservation software solution for Airline Companies project ...
construction of Reservation software solution for Airline Companies project ...
Hagi Sahib
 
Airline Reservation System - Java, Servlet ASP.NET, Oracle, HTML
Airline Reservation System - Java, Servlet ASP.NET, Oracle, HTMLAirline Reservation System - Java, Servlet ASP.NET, Oracle, HTML
Airline Reservation System - Java, Servlet ASP.NET, Oracle, HTML
Deepankar Sandhibigraha
 
Online Airline Ticket reservation System
Online Airline Ticket reservation SystemOnline Airline Ticket reservation System
Online Airline Ticket reservation Systemsathyakawthar
 

What's hot (20)

Airline reservation system
Airline reservation systemAirline reservation system
Airline reservation system
 
Air line reservation system software engeniring
Air line reservation system software engeniringAir line reservation system software engeniring
Air line reservation system software engeniring
 
Airline ticket reservation system
Airline ticket reservation systemAirline ticket reservation system
Airline ticket reservation system
 
Online Airway Reservation System
Online Airway Reservation SystemOnline Airway Reservation System
Online Airway Reservation System
 
Airline Management System [for presentation]
Airline Management System [for presentation]Airline Management System [for presentation]
Airline Management System [for presentation]
 
Airline Reservation System
Airline Reservation SystemAirline Reservation System
Airline Reservation System
 
Airline Reservation System - Software Engineering
Airline Reservation System - Software EngineeringAirline Reservation System - Software Engineering
Airline Reservation System - Software Engineering
 
Airline reservation system project report (1)
Airline reservation system project report (1)Airline reservation system project report (1)
Airline reservation system project report (1)
 
SRS on airline reservation system
SRS on airline reservation system SRS on airline reservation system
SRS on airline reservation system
 
Presentation On Online Airline Ticket Booking Project Planning
Presentation On Online Airline Ticket Booking Project PlanningPresentation On Online Airline Ticket Booking Project Planning
Presentation On Online Airline Ticket Booking Project Planning
 
Design and implementation of airline flight information system
Design and implementation of airline flight information systemDesign and implementation of airline flight information system
Design and implementation of airline flight information system
 
Air ticket reservation_system_presentati
Air ticket reservation_system_presentatiAir ticket reservation_system_presentati
Air ticket reservation_system_presentati
 
Airline Reservation System
Airline Reservation SystemAirline Reservation System
Airline Reservation System
 
Airline reservation system
Airline reservation system Airline reservation system
Airline reservation system
 
Airline reservation system
Airline reservation systemAirline reservation system
Airline reservation system
 
Flight reservation and ticketing system ppt
Flight reservation and ticketing system pptFlight reservation and ticketing system ppt
Flight reservation and ticketing system ppt
 
Airline management system
Airline management systemAirline management system
Airline management system
 
construction of Reservation software solution for Airline Companies project ...
construction of  Reservation software solution for Airline Companies project ...construction of  Reservation software solution for Airline Companies project ...
construction of Reservation software solution for Airline Companies project ...
 
Airline Reservation System - Java, Servlet ASP.NET, Oracle, HTML
Airline Reservation System - Java, Servlet ASP.NET, Oracle, HTMLAirline Reservation System - Java, Servlet ASP.NET, Oracle, HTML
Airline Reservation System - Java, Servlet ASP.NET, Oracle, HTML
 
Online Airline Ticket reservation System
Online Airline Ticket reservation SystemOnline Airline Ticket reservation System
Online Airline Ticket reservation System
 

Viewers also liked

Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3) Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3)
Aey Unthika
 
Airline reservation system documentation
Airline reservation system documentationAirline reservation system documentation
Airline reservation system documentation
Surya Indira
 
Project of Airline booking system
Project of Airline booking systemProject of Airline booking system
Project of Airline booking system
muthahar.sk
 
Introduction to airline reservation systems
Introduction to airline reservation systemsIntroduction to airline reservation systems
Introduction to airline reservation systemsJava and .NET Architect
 
Online assignment1
Online assignment1Online assignment1
Online assignment1
jessiegrag
 
Airlines Mis
Airlines MisAirlines Mis
Airlines Misankushmit
 
Database Project Airport management System
Database Project Airport management SystemDatabase Project Airport management System
Database Project Airport management System
Fahad Chishti
 
Introduction to Airline Information System
Introduction to Airline Information SystemIntroduction to Airline Information System
Introduction to Airline Information System
Siddhartha Tripathi
 
Dbms project list
Dbms project listDbms project list
Dbms project list
Anirudh Sriram
 

Viewers also liked (10)

Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3) Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3)
 
Airline reservation system documentation
Airline reservation system documentationAirline reservation system documentation
Airline reservation system documentation
 
Project of Airline booking system
Project of Airline booking systemProject of Airline booking system
Project of Airline booking system
 
Introduction to airline reservation systems
Introduction to airline reservation systemsIntroduction to airline reservation systems
Introduction to airline reservation systems
 
Online assignment1
Online assignment1Online assignment1
Online assignment1
 
Airlines Mis
Airlines MisAirlines Mis
Airlines Mis
 
Database Project Airport management System
Database Project Airport management SystemDatabase Project Airport management System
Database Project Airport management System
 
Introduction to Airline Information System
Introduction to Airline Information SystemIntroduction to Airline Information System
Introduction to Airline Information System
 
Overview of airline booking process
Overview of airline booking processOverview of airline booking process
Overview of airline booking process
 
Dbms project list
Dbms project listDbms project list
Dbms project list
 

Similar to Airline Database Design

Airport traffic control simple database model
Airport traffic control simple database modelAirport traffic control simple database model
Airport traffic control simple database model
master student
 
here is the SQL. PLEASE ONLY START FROM # 6 TO #10 AS I DID #1 TO #5.docx
here is the SQL. PLEASE ONLY START FROM # 6 TO #10 AS I DID #1 TO #5.docxhere is the SQL. PLEASE ONLY START FROM # 6 TO #10 AS I DID #1 TO #5.docx
here is the SQL. PLEASE ONLY START FROM # 6 TO #10 AS I DID #1 TO #5.docx
howard4little59962
 
RCCharter-DataWarehouseQueries
RCCharter-DataWarehouseQueriesRCCharter-DataWarehouseQueries
RCCharter-DataWarehouseQueriesPatrick Seery
 
Flight Reservation SystemThe flight reservation system” proje.docx
Flight Reservation SystemThe flight reservation system” proje.docxFlight Reservation SystemThe flight reservation system” proje.docx
Flight Reservation SystemThe flight reservation system” proje.docx
AKHIL969626
 
Mid office agent user's guide 2018-04-25
Mid office agent user's guide 2018-04-25Mid office agent user's guide 2018-04-25
Mid office agent user's guide 2018-04-25
laurafontaine1960
 
2014 10-23-oopsla-i3ql
2014 10-23-oopsla-i3ql2014 10-23-oopsla-i3ql
2014 10-23-oopsla-i3ql
Sebastian Erdweg
 
big data slides.pptx
big data slides.pptxbig data slides.pptx
big data slides.pptx
BSwethaBindu
 
[Challenge:Future] Database for Airport
[Challenge:Future] Database for Airport[Challenge:Future] Database for Airport
[Challenge:Future] Database for AirportChallenge:Future
 
Java Airline Reservation System – Travel Smarter, Not Harder.pdf
Java Airline Reservation System – Travel Smarter, Not Harder.pdfJava Airline Reservation System – Travel Smarter, Not Harder.pdf
Java Airline Reservation System – Travel Smarter, Not Harder.pdf
SudhanshiBakre1
 
Part I This part is worth 6 points. Create the following tables in yo.pdf
 Part I This part is worth 6 points. Create the following tables in yo.pdf Part I This part is worth 6 points. Create the following tables in yo.pdf
Part I This part is worth 6 points. Create the following tables in yo.pdf
ambritmobiles
 
Course project for CEE 4674
Course project for CEE 4674Course project for CEE 4674
Course project for CEE 4674
Junqi Hu
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
Jim Mlodgenski
 
Advanced MySQL Query Tuning
Advanced MySQL Query TuningAdvanced MySQL Query Tuning
Advanced MySQL Query Tuning
Alexander Rubin
 
In this assignment you will practice creating classes and enumeratio.pdf
In this assignment you will practice creating classes and enumeratio.pdfIn this assignment you will practice creating classes and enumeratio.pdf
In this assignment you will practice creating classes and enumeratio.pdf
ivylinvaydak64229
 
Predict Price of Airline Tickets.pptx
Predict Price of Airline Tickets.pptxPredict Price of Airline Tickets.pptx
Predict Price of Airline Tickets.pptx
Ahmedeltookhy1
 
Air Travel Analytics in SAS
Air Travel Analytics in SASAir Travel Analytics in SAS
Air Travel Analytics in SASRohan Nanda
 
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEOClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
Altinity Ltd
 
Data warehouse or conventional database: Which is right for you?
Data warehouse or conventional database: Which is right for you?Data warehouse or conventional database: Which is right for you?
Data warehouse or conventional database: Which is right for you?
Data Con LA
 
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB
 
Procure to pay base tables flow
Procure to pay base tables flowProcure to pay base tables flow
Procure to pay base tables flow
S Kumar G
 

Similar to Airline Database Design (20)

Airport traffic control simple database model
Airport traffic control simple database modelAirport traffic control simple database model
Airport traffic control simple database model
 
here is the SQL. PLEASE ONLY START FROM # 6 TO #10 AS I DID #1 TO #5.docx
here is the SQL. PLEASE ONLY START FROM # 6 TO #10 AS I DID #1 TO #5.docxhere is the SQL. PLEASE ONLY START FROM # 6 TO #10 AS I DID #1 TO #5.docx
here is the SQL. PLEASE ONLY START FROM # 6 TO #10 AS I DID #1 TO #5.docx
 
RCCharter-DataWarehouseQueries
RCCharter-DataWarehouseQueriesRCCharter-DataWarehouseQueries
RCCharter-DataWarehouseQueries
 
Flight Reservation SystemThe flight reservation system” proje.docx
Flight Reservation SystemThe flight reservation system” proje.docxFlight Reservation SystemThe flight reservation system” proje.docx
Flight Reservation SystemThe flight reservation system” proje.docx
 
Mid office agent user's guide 2018-04-25
Mid office agent user's guide 2018-04-25Mid office agent user's guide 2018-04-25
Mid office agent user's guide 2018-04-25
 
2014 10-23-oopsla-i3ql
2014 10-23-oopsla-i3ql2014 10-23-oopsla-i3ql
2014 10-23-oopsla-i3ql
 
big data slides.pptx
big data slides.pptxbig data slides.pptx
big data slides.pptx
 
[Challenge:Future] Database for Airport
[Challenge:Future] Database for Airport[Challenge:Future] Database for Airport
[Challenge:Future] Database for Airport
 
Java Airline Reservation System – Travel Smarter, Not Harder.pdf
Java Airline Reservation System – Travel Smarter, Not Harder.pdfJava Airline Reservation System – Travel Smarter, Not Harder.pdf
Java Airline Reservation System – Travel Smarter, Not Harder.pdf
 
Part I This part is worth 6 points. Create the following tables in yo.pdf
 Part I This part is worth 6 points. Create the following tables in yo.pdf Part I This part is worth 6 points. Create the following tables in yo.pdf
Part I This part is worth 6 points. Create the following tables in yo.pdf
 
Course project for CEE 4674
Course project for CEE 4674Course project for CEE 4674
Course project for CEE 4674
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
 
Advanced MySQL Query Tuning
Advanced MySQL Query TuningAdvanced MySQL Query Tuning
Advanced MySQL Query Tuning
 
In this assignment you will practice creating classes and enumeratio.pdf
In this assignment you will practice creating classes and enumeratio.pdfIn this assignment you will practice creating classes and enumeratio.pdf
In this assignment you will practice creating classes and enumeratio.pdf
 
Predict Price of Airline Tickets.pptx
Predict Price of Airline Tickets.pptxPredict Price of Airline Tickets.pptx
Predict Price of Airline Tickets.pptx
 
Air Travel Analytics in SAS
Air Travel Analytics in SASAir Travel Analytics in SAS
Air Travel Analytics in SAS
 
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEOClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
 
Data warehouse or conventional database: Which is right for you?
Data warehouse or conventional database: Which is right for you?Data warehouse or conventional database: Which is right for you?
Data warehouse or conventional database: Which is right for you?
 
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
 
Procure to pay base tables flow
Procure to pay base tables flowProcure to pay base tables flow
Procure to pay base tables flow
 

More from Abhishek Jaisingh

Movie recommendation project
Movie recommendation projectMovie recommendation project
Movie recommendation project
Abhishek Jaisingh
 
Deep Q-learning Flappy Bird
Deep Q-learning Flappy BirdDeep Q-learning Flappy Bird
Deep Q-learning Flappy Bird
Abhishek Jaisingh
 
Traffic Lights Controller in VHDL
Traffic Lights Controller in VHDLTraffic Lights Controller in VHDL
Traffic Lights Controller in VHDL
Abhishek Jaisingh
 
Snake Game Report
Snake Game ReportSnake Game Report
Snake Game Report
Abhishek Jaisingh
 
Client Server Model and Distributed Computing
Client Server Model and Distributed ComputingClient Server Model and Distributed Computing
Client Server Model and Distributed Computing
Abhishek Jaisingh
 
Forget Me Not Report
Forget Me Not ReportForget Me Not Report
Forget Me Not Report
Abhishek Jaisingh
 
Skype
SkypeSkype
Quantum Computing Report
Quantum Computing ReportQuantum Computing Report
Quantum Computing Report
Abhishek Jaisingh
 
Quantum Computing
Quantum ComputingQuantum Computing
Quantum Computing
Abhishek Jaisingh
 
Innovative Business Models Presentation
Innovative Business Models PresentationInnovative Business Models Presentation
Innovative Business Models Presentation
Abhishek Jaisingh
 

More from Abhishek Jaisingh (10)

Movie recommendation project
Movie recommendation projectMovie recommendation project
Movie recommendation project
 
Deep Q-learning Flappy Bird
Deep Q-learning Flappy BirdDeep Q-learning Flappy Bird
Deep Q-learning Flappy Bird
 
Traffic Lights Controller in VHDL
Traffic Lights Controller in VHDLTraffic Lights Controller in VHDL
Traffic Lights Controller in VHDL
 
Snake Game Report
Snake Game ReportSnake Game Report
Snake Game Report
 
Client Server Model and Distributed Computing
Client Server Model and Distributed ComputingClient Server Model and Distributed Computing
Client Server Model and Distributed Computing
 
Forget Me Not Report
Forget Me Not ReportForget Me Not Report
Forget Me Not Report
 
Skype
SkypeSkype
Skype
 
Quantum Computing Report
Quantum Computing ReportQuantum Computing Report
Quantum Computing Report
 
Quantum Computing
Quantum ComputingQuantum Computing
Quantum Computing
 
Innovative Business Models Presentation
Innovative Business Models PresentationInnovative Business Models Presentation
Innovative Business Models Presentation
 

Recently uploaded

Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
VivekSinghShekhawat2
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
GTProductions1
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 

Recently uploaded (20)

Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 

Airline Database Design

  • 1. Air India Database Design DBMS (CSN-351) Group Number - 1 Abhishek Jaisingh 14114002 Amandeep 14114008 Tirth Patel 14114036 ​Table of Contents ER Diagram 2 Assumptions 2 Initial Schema Diagram 3 Tables with FDs 4 Final Schema Diagram 8 Basic Operations with SQL queries and results 9 1
  • 2. ER diagram Assumptions 1. There is a route code table not listed as separate table in our design, which has information about all the intermediate airports in a journey with specific route code. 2. A person can only book 1 ticket per transaction. A new transaction is required again to book more tickets. 3. Fare for the each flight in AirFare table is calculated separately using the Route of the flight. 2
  • 4. Tables with functional dependencies Country [BCNF] Primary Key: CtID CtID → CountryName CREATE TABLE ​`Country` ( `CtID`​ INT NOT NULL AUTO_INCREMENT, `CountryName`​ varchar​(​32​)​ NOT NULL, PRIMARY KEY ​(​`CtID`) ); State [BCNF] Primary Key: StID StID → StateName | Country CREATE TABLE ​`State` ( `StID`​ INT NOT NULL AUTO_INCREMENT UNIQUE, `StateName`​ varchar​(​32​)​ NOT NULL, `Country`​ INT NOT NULL, PRIMARY KEY ​(​`StID`​), FOREIGN KEY ​(​`Country`​)​ REFERENCES ​`Country`​(​`CtID`) ); Contact_Details [BCNF] Primary Key: CnID CnID → Email | Mobile | State CREATE TABLE ​`Contact_Details` ( `CnID`​ INT NOT NULL AUTO_INCREMENT, `Email`​ varchar​(​50​)​ NOT NULL, `Mobile`​ varchar​(​16​)​ NOT NULL, `State`​ INT NOT NULL, PRIMARY KEY ​(​`CnID`​), FOREIGN KEY ​(​`State`​)​ REFERENCES ​`State`​(​`StID`) 4
  • 5. ); Passenger [BCNF] Primary Key: PsID PsID → Name | Address | Age | Nationality | Contacts CREATE TABLE ​`Passenger` ( `PsID`​ INT NOT NULL AUTO_INCREMENT, `Name`​ varchar​(​32​)​ NOT NULL, `Address`​ varchar​(​64​)​ NOT NULL, `Age`​ INT NOT NULL, `Nationality`​ varchar​(​16​)​ NOT NULL, `Contacts`​ INT NOT NULL, PRIMARY KEY ​(​`PsID`​), FOREIGN KEY ​(​`Contacts`​)​ REFERENCES ​`Contact_Details`​(​`CnID`) ); Transaction [BCNF] Primary Key: TsID TsID → BookingDate | Passenger | Flight CREATE TABLE ​`Transaction` ( `TsID`​ INT NOT NULL AUTO_INCREMENT, `BookingDate`​ DATETIME NOT NULL, `Passenger`​ INT NOT NULL, `Flight`​ INT NOT NULL, PRIMARY KEY ​(​`TsID`​), FOREIGN KEY ​(​`Passenger`​)​ REFERENCES ​`Passenger`​(​`PsID`​), FOREIGN KEY ​(​`Flight`​)​ REFERENCES ​`Flight_Schedule`​(​`FlID`) ); Flight_Schedule [2NF] Primary Key: FlID FlID → FlightDate | Departure | Arrival | AirCraft | NetFare Departure → FlightDate 5
  • 6. CREATE TABLE ​`Flight_Schedule` ( `FlID`​ INT NOT NULL AUTO_INCREMENT, `FlightDate`​ DATE NOT NULL, `Departure`​ DATETIME NOT NULL, `Arrival`​ DATETIME NOT NULL, `AirCraft`​ INT NOT NULL, `NetFare`​ INT NOT NULL, PRIMARY KEY ​(​`FlID`​), FOREIGN KEY ​(​`AirCraft`​)​ REFERENCES ​`AirCraft`​(​`AcID`​), FOREIGN KEY ​(​`NetFare`​)​ REFERENCES ​`AirFare`​(​`AfID`) ); Note : This table is in 2NF due to the derivation of FlightDate from Departure attribute which is trivial. Removing this dependency by adding extra table only for FlightDate enhances the overhead for queries. Keeping it in this form results in very little reduction in memory efficiency. AirFare [BCNF] Primary Key: AfID AfID → Route | Fare CREATE TABLE ​`AirFare` ( `AfID`​ INT NOT NULL AUTO_INCREMENT, `Route`​ INT NOT NULL, `Fare`​ INT NOT NULL, PRIMARY KEY ​(​`AfID`​), FOREIGN KEY ​(​`Route`​)​ REFERENCES ​`Route`​(​`RtID`) ); Route [BCNF] Primary Key: RtID RtID → Airport | Destination | RouteCode CREATE TABLE ​`Route` ( `RtID`​ INT NOT NULL AUTO_INCREMENT, `Airport`​ varchar​(​32​)​ NOT NULL, `Destination`​ varchar​(​32​)​ NOT NULL, `RouteCode`​ varchar​(​16​)​ NOT NULL UNIQUE, PRIMARY KEY ​(​`RtID`) 6
  • 7. ); Note : Here RouteCode will be is unique number recognizing the route of the flight between given 2 airports. AirCraft [2NF] Primary Key: AcID AcID → Ac_Type | Capacity | Mfg_Date Ac_Type → Capacity Note : To convert into ​BCNF​, this table is decomposed into 2 new following tables AirCraft​ and ​AirCraft_Type​. AirCraft [BCNF] (from decomposition) Primary Key: AcID AcID → Ac_Type | Ac_Type | Mfg_Date CREATE TABLE ​`AirCraft` ( `AcID`​ INT NOT NULL AUTO_INCREMENT, `Ac_Type`​ INT NOT NULL, `Mfg_Date`​ DATE NOT NULL, PRIMARY KEY ​(​`AcID`​), FOREIGN KEY ​(​`Ac_Type`​)​ REFERENCES ​`AirCraft_Type`​(​`ActID`) ); AirCraft_Type [BCNF] (from decomposition) Primary Key: ActID ActID → Type | Capacity CREATE TABLE ​`AirCraft_Type` ( `ActID`​ INT NOT NULL AUTO_INCREMENT, `Type`​ varchar​(​32​)​ NOT NULL, `Capacity`​ INT NOT NULL, PRIMARY KEY ​(​`ActID`) ); 7
  • 8. Final Schema Diagram This is final schema diagram after decomposition. These 10 tables are made in our Air India database design. 8
  • 9. Basic Operations Here are some basic operations listed that our database provides. Each functionality is shown with corresponding sample SQL query and screenshot. 1. List all the aircrafts older than '2' years (can be used for expiry dates or maintenance date) SELECT ​AcID​,​ ​Mfg_Date​,​ ​Type FROM ​AirCraft​ INNER JOIN ​AirCraft_Type​ ON ​(​AirCraft​.​Ac_Type​ ​=​ ​AirCraft_Type​.​ActID​) WHERE YEAR​(​CURDATE​())​ ​-​ YEAR​(​Mfg_Date​)​ ​>​ 2 2. List all the flights in database from airport 'New Delhi' to airport 'Bangalore' SELECT ​FlId​,​ ​FlightDate​,​ ​Fare​,​ ​Departure​,​ ​Arrival FROM ​((​Flight_Schedule​ INNER JOIN ​AirFare​ ON ​(​Flight_Schedule​.​NetFare​ ​=​ ​AirFare​.​AfID​))) INNER JOIN ​Route​ ON ​(​Route​ ​=​ ​RtID​) WHERE ​Airport​ ​=​ ​'New Delhi'​ AND ​Destination​ ​=​ ​'Bangalore' 9
  • 10. 3. List all the passengers for flight no. '5' SELECT NAME​,​ ​Age​,​ ​Mobile FROM ​Transaction​ INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​) INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​) WHERE ​Flight​ ​=​ ​5 ORDER BY NAME 4. List all the minor (age less than 18) travelling in flight no. '5' SELECT ​Name​,​ ​Age​,​ ​Mobile​,​ ​Address​,​ ​StateName​,​ ​CountryName FROM ​Transaction​ INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​) INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​) INNER JOIN ​State​ ON ​(​State​ ​=​ ​StID​) INNER JOIN ​Country​ ON ​(​CtID​ ​=​ ​Country) WHERE ​Flight​ ​=​ ​5​ AND ​Age​ ​<​ ​18 ORDER BY NAME​,​ ​Age 10
  • 11. 5. Total Fare collected from date '2016-10-01' to date '2016-10-20' SELECT SUM​(​Fare​) FROM ​Transaction​ INNER JOIN ​Flight_Schedule​ ON ​(​Flight​ ​=​ ​FlID​) INNER JOIN ​AirFare​ ON ​(​NetFare​ ​=​ ​AfID​) WHERE DATE ​(​BookingDate​)​ BETWEEN ​'2016-10-01'​ AND ​'2016-10-20' 6. Total number of tickets booked from date '2016-10-10' to date '2016-11-25' SELECT COUNT​(​PsID​)​ AS ​Tickets FROM ​Transaction​ INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​) INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​) WHERE DATE ​(​BookingDate​)​ BETWEEN ​'2016-10-10'​ AND ​'2016-11-25'; 7. Number of persons travelling airport 'New Delhi' from date '2016-11-1' to date '2016-11-30' SELECT COUNT​(​PsID​)​ AS NUM_CUSTOMERS FROM ​Route​ INNER JOIN ​AirFare​ ON ​(​RtID​ ​=​ ​Route​) INNER JOIN ​Flight_Schedule​ ON ​(​AfID​ ​=​ ​NetFare​) INNER JOIN ​Transaction​ ON ​(​Flight​ ​=​ ​FlID​) INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​) INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​) WHERE DATE ​(​FlightDate​)​ BETWEEN ​'2016-11-1'​ AND ​'2016-11-30'​ AND ​Airport​ ​=​ ​'New Delhi'; 11
  • 12. 8. Number of persons reaching at 'New Delhi' from date '2016-11-1' to date '2016-11-30' SELECT COUNT​(​PsID​)​ AS NUM_CUSTOMERS FROM ​Route​ INNER JOIN ​AirFare​ ON ​(​RtID​ ​=​ ​Route​) INNER JOIN ​Flight_Schedule​ ON ​(​AfID​ ​=​ ​NetFare​) INNER JOIN ​Transaction​ ON ​(​Flight​ ​=​ ​FlID​) INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​) INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​) WHERE DATE ​(​FlightDate​)​ BETWEEN ​'2016-11-1'​ AND ​'2016-11-30'​ AND ​Destination​ ​=​ ​'New Delhi'; 9. Number of persons with flights from 'New Delhi' to 'Bangalore' from date '2016-11-1' to date '2016-11-30' SELECT COUNT​(​PsID​)​ AS NUM_CUSTOMERS FROM ​Route​ INNER JOIN ​AirFare​ ON ​(​RtID​ ​=​ ​Route​) INNER JOIN ​Flight_Schedule​ ON ​(​AfID​ ​=​ ​NetFare​) INNER JOIN ​Transaction​ ON ​(​Flight​ ​=​ ​FlID​) INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​) INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​) WHERE DATE ​(​FlightDate​)​ BETWEEN ​'2016-11-1'​ AND ​'2016-11-30'​ AND ​Airport​ ​=​ ​'New Delhi' AND ​Destination​ ​=​ ​'Bangalore'; 10. Provide State wise analysis of sales of flight tickets SELECT ​StateName​,​ ​Count​(​PsID​)​ AS ​Tickets FROM ​Transaction​ INNER JOIN ​Passenger​ ON ​(​Transaction​.​Passenger​ ​=​ ​PsID​) INNER JOIN ​Contact_Details​ ON ​(​Contacts​ ​=​ ​CnID​) INNER JOIN ​State​ ON ​(​State​ ​=​ ​StID​) GROUP BY ​StateName ORDER BY ​Count​(​PsID​)​ DESC; 12
  • 13. 13