AirIndia Design
AirIndia Design
DBMS (CSN-351)
Group Number - 1
Amandeep 14114008
Table of Contents
ER Diagram 2
Assumptions 2
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]
CtID → CountryName
State [BCNF]
Contact_Details [BCNF]
4
);
Passenger [BCNF]
Transaction [BCNF]
Flight_Schedule [2NF]
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]
Route [BCNF]
6
);
Note : Here RouteCode will be is unique number recognizing the route of the flight
between given 2 airports.
AirCraft [2NF]
Note : To convert into BCNF, this table is decomposed into 2 new following tables
AirCraft and AirCraft_Type.
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)
2. List all the flights in database from airport 'New Delhi' to airport 'Bangalore'
9
3. List all the passengers for flight no. '5'
4. List all the minor (age less than 18) travelling in flight no. '5'
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'
7. Number of persons travelling airport 'New Delhi' from date '2016-11-1' to date
'2016-11-30'
11
8. Number of persons reaching at 'New Delhi' from date '2016-11-1' to date
'2016-11-30'
9. Number of persons with flights from 'New Delhi' to 'Bangalore' from date
'2016-11-1' to date '2016-11-30'
12
13