Database Design Project

advertisement
Database Design and SQL Project
Air Ticket Selling System
(20 marks of total scores)
Assumption:
All Airlines set standard ticket prices for all agents for each seat class based on flight no. and
flight date, e.g., For Cathay, the ticket prices for First, Business, Economy class of flight no
CX001 on 1/Jan/2009 are $30000, $15000, and $5000. In this project, these prices are named
Airline Price. Each travel agent will base on the Airline Price + its profit to determine the ticket
selling price (Agent Price) (i.e. customer pay the agent price to buy a ticket).
You only deal with direct flight, that is, each flight is from one airport to another airport.
Background of the project:
This system is about the air-ticket selling operations.
travel agents, and customers (passengers).
Stakeholders include airline companies,
Each airline company will offer various flights from one airport to another airport, such as from
HKG (Hong Kong International Airport) to LHR (Heathrow Airport of England). There are three
types of tickets for each flights, First class, Business class, and Economy class.
For each flight, information includes (Airline, flight no., flight date, departure time, airplane
model, original airport, destination airport and the likes).
For each airplane type, information includes (airplane model, no of seat for first class, no of seat
for Business class, no of seat for Economy class)
For each travel agent, information includes (Agent code, address, and tel.no.)
There should be a table about airport, city and country, for example:
Airport
HKG
City
Hong Kong
Country
China
LHR
London
England
LGW
London
England
PGV
Shanghai
China
SIN
Singapore
Singapore
…
…
…
To issue an air ticket, the following information is needed:
Passenger Passport ID.
Passenger Name.
Class.
Flight No.
Travel agent Code.
Flight Departure Date
Flight Departure Time.
Ticket Price (Agent Price).
Original Airport and City.
Ticket selling Date.
Destination Airport and City.
Airline.
Drawing E-R diagram
1. To identify all valid entities and all attributes of each entity.
2.
3.
4.
5.
To identify all relationship among entities.
Draw an E-R diagram base 1 & 2 above.
Normalise all entities.
Define correct primary keys, data types, foreign keys, and all necessary constraints, such as
ticket_price number (5) and the price must > 0.
6. Prepare the test data/records. (The no. of record needed for each table – just make sure that
each SQL execution will return at least one result record.)
SQL for Enquires
For customers:
(1) Is there any flight from one particular country to another particular country? (e.g. from China
to Japan).
Show info.: Airline, flight no., departure time, departure country, arrival country.
(2) Is there any flight from one particular city to another particular city? (e.g. From Hong Kong
to Tokyo).
Show info.: Airline, flight no., departure time, departure city, arrival city.
(3) What is the cheapest airline price to fly from one particular city to another particular city?
SQL should show: Airline, flight no., departure time, airline price, departure city, arrival city
(4) What is the cheapest First-class price to fly from one particular city to another particular city?
SQL should show: Airline, flight no., departure time, airline price.
(5) Are there any flights from one particular city to another particular city on 15th April this year?
SQL should show: Airline, flight no., departure date, departure time.
(6) Is there any flight from one particular city to another particular city on between 1st April and
5th April of this year?
SQL should show: Airline, flight no., departure date, departure time.
* Note: name all queries above with name like CU01.sql, CU02.sql, to CU06.sql
For travel agent
(1) Find all flights that the airline price is between $1000 and $6000.
SQL should show: Airline, class, departure date, departure city, arrival city.
(2) Find the no. of seat available for all flights from one particular city to another particular city
for a particular class on a particular date?
SQL should show: Airline, flight no., class, departure date, departure time, no. of seats
available.
(3) Find the profit earned (agent price - airline price) by a particular agent for a particular month
and year.
SQL should show: Year, month, agent name, profit earned.
(4) Find the profit earned (agent price - airline price) by all agents for all dates (group by agent
code, year, and month).
SQL should show: Agent name, year, month, profit earned.
* Note: name all queries above with name like TA01.sql, TA02.sql, to TA04.sql
For Airline:
(1) Find all flights possessed by each airline?
SQL should show: Airline name, flight no., departure time, departure city, arrival city.
(2) Show the income earned of a particular airline (just sum the airline price of all tickets sold)
for a particular period.
SQL should show: Airline name, year, month, income earned.
(3) Show the income earned of all particular airlines for all years and months.
SQL should show: Airline name, year, month, income earned.
Note: name all queries above with name like AL01.sql, AL02.sql, to AL03.sql.
Submission
At end of the project, you should submit:
(1) A table shows contribution of each team member (see figure 1 below).
(2)
(3)
(4)
(5)
An E-R diagram.
A listing of all SQL that create your tables.
A listing of all records of each table.
A listing of all SQL statements.
Marks will be given to:
(1) Correct E-R Diagram.
(2) Correct column definition, including, correct column name, correct data type (e.g. Number) and
correct data type value (e.g. number(6,1)).
(3) Correct integrity constraints.
(4) Correct assumptions.
Figure 1.
Student
Database Design E-R
SQL writing
Total
John
20%
5%
25%
May
30%
10%
40%
...
…
…
Total
100%
100%
100%
Download