Uploaded by Lucifer Zero

apu_normlization_assignment

Business Rules for Train Reservation System
1. Train Information:
o Each train has a unique train number.
o Each train has a total number of seats for business and economy classes.
o Each train has a specific date and time for departure and arrival.
o Each train starts and ends at a specific state.
2. Train Routes:
o There are three train routes: Northern Track, Southern Track, and East Coast
Track.
o Northern Track: Kuala Lumpur, Perak, Pulau Pinang, Kedah, Perlis.
o Southern Track: Kuala Lumpur, Melaka, Negeri Sembilan, Johor.
o East Coast Track: Kuala Lumpur, Pahang, Terengganu, Kelantan.
3. Train Operations:
o Northern Track operates more than four trains a day.
o Southern Track operates only five trains a day.
o East Coast Track operates less than four trains a day.
o Each train must have two operators (captain and co-captain) and a maximum
of three attendants.
o An operator may operate one or more trains.
4. Train Operators:
o Each operator has a unique employee number.
o Operators have first and last names, age, years of experience, position, lead
hours, and salary.
o Operators with 20,000+ operation hours are categorized as senior operators.
o There must be at least two senior operators.
5. Train Attendants:
o Each attendant has a unique ID.
o Attendants have a full name, position, salary, phone number, and address.
6. Customers:
o Customers have a first and last name, mailing address, phone numbers, and
email addresses.
o Mailing address includes street, city, state, postal code, and country.
o Each customer may have one or more reservations.
o Email addresses are unique for each customer.
o First and last names do not have to be unique.
7. Reservations:
o Each reservation has a unique reservation number.
o Reservation includes state made from, reservation date, traveling date, train
number, number of seats reserved, departure station, destination, charges, and
total.
o Customers can reserve more than one train per booking.
Example of UNF and Normalization
To properly design the database for the Train Reservation System and ensure it meets the
normalization requirements up to the Third Normal Form (3NF), we'll start with the
Unnormalized Form (UNF) and proceed step-by-step through each normalization form.
Here's the process:
Unnormalized Form (UNF)
In the UNF, we start with the initial structure based on the provided requirements
mail_add
First_name
Last_name
Res_num
Res_state
Res_state
Travel_date
Train_num
Seats_res
Salary
attendID
Full_name
Phone_num
Position
Address
salary
State
Exp_years
Position
Lead_hours
Emp_num
Train_nu
m
First_name
Bus_seats_nu
m
Phone_num
Last_name
Departure_da
te
Age
mailID
Departure_ti
me
Salary
Arrival_ti
me
mailID
Street
Arrival_da
te
City
State
Postal_code
Country
Departure
Train_totalCharge
Res_toal
Station
Total_num_train
Salary
Origin_sta
te
Destination_sta
te
Countr
y
First Normal Form (1NF)
To achieve 1NF, we ensure that each table has a primary key and all attributes are atomic (no
repeating groups or arrays):
Normalized Table in 1NF:
attendID
Full_name
Phone_num
Position
Emp_num
First_name
Train_nu
m
Bus_seats_nu
m
Res_num
Res_state
mail_add
Address
RouteId
Last_name
Age
Exp_years
Position
Departure_ti
me
Arrival_ti
me
Arrival_da
te
Departure_da
te
Res_state
First_name
salary
Travel_date
Last_name
State
Train_num
Phone_num
mailID
South_track
Seats_res
Street
North_track
Lead_hours
Origin_sta
te
Salary
City
EastCoast_track
State
Station
Total_num_train
Salary
Destination_sta
te
Departure
Countr
y
Train_totalCharge
Postal_code
Country
Res_toal
Second Normal Form (2NF)
In 2NF, we eliminate partial dependencies and ensure all attributes depend on the whole
primary key:
Train Table:
Train_num
attendID
Full_name
Bus_seats_num
Phone_num
Departure_date
Position
Address
Departure_time
salary
Arrival_time
RouteId
Arrival_date
Origin_state
State
South_track
North_track
Seats_res
Salary
Departure
Destination_state
EastCoast_track
Country
Station
Total_num_train
Reservation Table:
Res_num
Res_state
Res_state
Emp_num
mail_add
First_name
Travel_date
First_name
Last_name
Train_num
Last_name
Phone_num
Age
Exp_years
mailID
Street
Position
City
Train_totalCharge
Lead_hours
State
Salary
Postal_code
Country
Res_toal
Third Normal Form (3NF)
Finally, in 3NF, we remove transitive dependencies:
Train Table:
Train_num
attendID
Full_name
Bus_seats_num
Phone_num
Departure_date
Position
Address
Departure_time
salary
Arrival_time
RouteId
Arrival_date
Origin_state
State
South_track
North_track
Seats_res
Salary
Departure
Destination_state
EastCoast_track
Country
Station
Total_num_train
Reservation Table:
Res_num
Res_state
Res_state
Emp_num
mail_add
Travel_date
First_name
First_name
Last_name
Train_num
Last_name
Age
Phone_num
Exp_years
mailID
Position
Street
City
Train_totalCharge
Lead_hours
State
Res_toal
Salary
Postal_code
Country
Customer Table:
mail_add
First_name
Last_name
Phone_num
mailID
Street
City
State
Postal_code
Country
Train Attendants Table:
attendID
Full_name
Phone_num
Position
Address
salary
Routes Table:
RouteId
State
South_track
North_track
EastCoast_track
Station
Total_num_train
Train Operators Table:
Emp_num
First_name
Last_name
Age
Exp_years
Position
Lead_hours
Salary