Вы находитесь на странице: 1из 9

University of Education, Lahore (Okara Campus)

Department of Computer Science & IT


Programme Name: BS (Hons.) IT
Assignment #:
1
Topic: Normalization

Course Title: Database Administration


Assignment out:
8-10-2015
Last date of submission:
16-10-2015

Semester: ____________5th________

Section: ______2013-2017________

Name:

____ Ahmed Arshad ______

Roll #_____1055________

Instructions:
1. Submit your assignment in hard form in class on A4 paper size and it must include 1 st page: print of this
sheet.
2. Late submission policy: deduction @ of 10% of total marks per day.
3. 100% correct solution is required. There will be no partial marks.
4. The Assignment is individual task
5. Show your work for each step of the process.
6. Show each table at each stage of normalization and label it.
7. Label each table and provide a description of the assumptions that you made in bringing the table(s) to
the specified level of normalization.
8. Describe your assumptions and related logic.
9.

All elements should be neatly typed on plain white paper. You can use whatever documentation tools
that you find useful for this exercise.

10. You will be graded on the correctness, completeness, and quality of your effort.
Hint: you can visit PIA website to understand the problem statement more precisely.
http://www.piac.com.pk/
11.
Copy of assignment from web or any source such as classmate will not be tolerated.
policy will be implemented for such cases.

Strict

Q1) The first part will involve a table that is partially of your own design. Use a report such as a sales
summary, a telephone bill, a credit card invoice, etc. to build a single table. Extract the fields represented on the
report and build a single table from these fields. Next, identify the dependencies/anomalies between these
fields. Finally, if appropriate, normalize the table up to 3NF.
(50%)
Q2) for the following description of an airline reservation system, identify the functional dependencies between
each field and build normalized tables based on these dependencies.
(50%)
PIA Airlines wants to develop database for its advanced reservation system. Some of the information that are
of particular importance for the reservation system include the following:

Flight information such as a flight number, the origin city, the destination city, scheduled departure time,
and scheduled arrival time need to be recorded. All of their flights are non-stop,

A specific flight will occur on a specific day and have a specific crew assigned to the flight. In
particular, the crew information that needs to be recorded included the employee ID and the employees
role on the flight (e.g., captain, flight attendant, etc.).

Specific pieces of equipment (i.e., planes) will need to be accounted for. Information such as the
Airplane ID, model, and capacity will need to be recorded.

Employee information will include their ID, name, cell/office phone, and title.

Information about customers includes their ID, name, phone number, and mailing address.

Reservations made by customers are recorded with a reservation number, the flight information,
customer information, the date, the fare, the payment method.

In the process of completing this assignment, perform the following steps for each of the two problems
discussed above.
1. List the fields in one table horizontally across the page and add some data (of your own design) below
each field You only need to include as much data as needed to understand the relationships between the
fields (i.e., you only need as many records as it takes to understand the dependencies between the
fields).
2. Make sure that the initial table is in 1NF. At this stage, it is probably still a good idea to maintain some
of your example data in the table. Make certain that you identify the primary key for each [mega] table.
3. Identify the functional dependencies that exist between the fields. You can probably drop the data from
the tables (unless it helps you to understand the functional dependencies). This also implies that you
will need to identify and display the candidate keys. When defining candidate keys, make certain that
you think about how to truly make each key unique
4. Convert the tables into higher levels of normalization. All tables should be normalized to at least 3NF to
complete the process (if you don't bring a table to a higher level of normalization, explain why this was
not done). Show all steps. It is probably a good idea to include an explanation of your rationale for the
actions taken at each step of the process
Throughout the normalization process, make certain that you identify the primary key by underlining the
field(s) that constitutes the primary key (when you build new tables, also italicize any foreign keys that you
identify -- this will help you verify that you are completing the normalization process properly). It is also
important that you show and explain your work and the logic that helps me to understand why you made the
changes that you made for each stage of normalization. Make certain that you show the progression from
lower levels of normalization to the higher levels. In other words, do not jump from normalized table to the
highest level of normalization (I want to see the logic and stages that you progressed through
in completing the project).

Q1) The first part will involve a table that is partially of your own design. Use a report such as a sales
summary, a telephone bill, a credit card invoice, etc. to build a single table. Extract the fields represented
on the report and build a single table from these fields. Next, identify the dependencies/anomalies
between these fields. Finally, if appropriate, normalize the table up to 3NF.
What is Normalization?
Database normalization is the process of efficiently organizing data in a database. There are two reasons of the
normalization process:

Eliminating redundant data,

Ensuring that data dependencies make sense.

Normalization is very important part of the database. To remove redundancy of data i.e. having same
information stored at multiple places, which eventually be difficult to maintain and will also increase the size of
our
database.
With normalization we will have tables with fewer columns which will make data retrieval and insert, update
and delete operations more efficient.
There are some steps we use in normalization process called normalization forms. They are five but mostly we
use first three.

1NF
2NF
3NF

Teacher Table:
Teacher
Ahmad
Ali
Faisal

Age
25
34
27

Su
Biolo
M
M

First Normal Form (1NF)


As per First Normal Form, no two Rows of data must contain repeating group of information i.e. each set of
column must have a unique value, such that multiple columns cannot be used to fetch the same row. Each table
should be organized into rows, and each row should have a primary key that distinguishes it as unique.
The Primary key is usually a single column, but sometimes more than one column can be combined to create a
single primary key. For example consider a table which is not in First normal form

In First Normal Form, any row must not have a column in which more than one value is saved, like separated
with commas. Rather than that, we must separate such data into multiple rows.

Teacher Table following 1NF will be:


Teacher

Age

Subject

Ahmad
25
Biology
Ahmad
25
Math
Ali
34
Math
Stuart
27
Math
Using the First Normal Form, data redundancy increases, as there will be many columns with same data in
multiple rows but each row as a whole will be unique.

Second Normal Form (2NF)


As per the Second Normal Form there must not be any partial dependency of any column on primary key. It
means that for a table that has concatenated primary key, each column in the table that is not part of the primary
key must depend upon the entire concatenated key for its existence. If any column depends only on one part of
the concatenated key, then the table fails Second normal form.
In example of First Normal Form there are two rows for Adam, to include multiple subjects that he has opted
for. While this is searchable, and follows First normal form, it is an inefficient use of space. Also in the above
Table in First Normal Form, while the candidate key is {Student, Subject}, Age of Student only depends on
Student column, which is incorrect as per Second Normal Form. To achieve second normal form, it would be
helpful to split out the subjects into an independent table, and match them up using the student names as foreign
keys.

New Teacher Table following 2NF will be:


Teacher
Ahmad
Ali
Faisal

Age
25
34
27

In Student Table the candidate key will be Student column, because all other column i.e. Age is dependent on it.

New Subject Table introduced for 2NF will be:


Teacher

Subject

Ahmad
Biology
Ahmad
Math
Ali
Math
Faisal
Math
In Subject Table the candidate key will be {Student, Subject} column. Now, both the above tables qualify for
Second Normal Form and will never suffer from Update Anomalies. Although there are a few complex cases in
which table in Second Normal Form suffers Update Anomalies, and to handle those scenarios Third Normal
Form is there.

Third Normal Form (3NF)


Third Normal form applies that every non-prime attribute of table must be dependent on primary key, or we
can say that, there should not be the case that a non-prime attribute is determined by another non-prime
attribute. So this transitive functional dependency should be removed from the table and also the table must be
in Second Normal form. For example, consider a table with following fields.

Teacher _Detail Table:


Teacher_id

Teacher_name

DOB

Street

city

State

Zip

In this table Teacher_id is Primary key, but street, city and state depends upon Zip. The dependency between zip
and other fields is called transitive dependency. Hence to apply 3NF, we need to move the street, city and state
to new table, with Zip as primary key.

New Teacher_Detail Table:


Teacher_id
Address Table:
Zip

Teacher_name
Teacher_Street

The advantage of removing transitive dependency is,

Amount of data duplication is reduced.

Data integrity achieved.

DOB
city

Zip
state

Q2) for the following description of an airline reservation system, identify the functional dependencies
between each field and build normalized tables based on these dependencies.

PIA Airlines wants to develop database for its advanced reservation system. Some of the information that
are of particular importance for the reservation system include the following:

Flight information such as a flight number, the origin city, the destination city, scheduled
departure time, and scheduled arrival time need to be recorded. All of their flights are non-stop,

A specific flight will occur on a specific day and have a specific crew assigned to the flight. In
particular, the crew information that needs to be recorded included the employee ID and the
employees role on the flight (e.g., captain, flight attendant, etc.).

Specific pieces of equipment (i.e., planes) will need to be accounted for. Information such as the
Airplane ID, model, and capacity will need to be recorded.

Employee information will include their ID, name, cell/office phone, and title.

Information about customers includes their ID, name, phone number, and mailing address.

Reservations made by customers are recorded with a reservation number, the flight information,
customer information, the date, the fare, the payment method.

Airline Information System


This system basically concerned with the reservation system of the airline system.
It is also concerned with the details of the passengers.
It is also useful to generate the information about any particular Flight and Planes.
It will do according to the airline services of the different countries.
Some of the objectives are listed below:

Data will be store in organized form.


Data manipulation will be easy.
To reduce number of registers and documents.
To reduce the time needed to reduce this job.
To enable the passengers to save their time by using quick reservation.
Easy to maintain the records.

Record navigation will be very easy.


Record duplication will be eliminated.
Searching of any record will be very easy and very fast.

Normalized Tables for airline database system


Flight table
Flight_ID

Departure

Arrival

Total Passenge

Flight information such as a flight number, the origin city, the destination city. All of their flights are
non-stop

Plane Details
Plane_ID

Flight_ID

Model

Capacity

Specific pieces of equipment (i.e., planes) will need to be accounted for. Information such as the
Airplane ID, model, and capacity will need to be recorded.

Schedule
Schedule_ID

Departure_time

Departure_date

Arrival_time

Arrival_date

Flight_ID

Schedule table includes Schedule id, departure time, and scheduled arrival time need to be recorded.

Employee Information
Employee_ID

Employee_job

Flight_ID

Crew information includes members of a flight from captain to flight attendant.

Customers Information
Cus_ID

Phone_no

Mailing_address

Payment_Method

Reservation
Cus_ID

F_name

L_name

NIC_no

Nationality

Gender

Passport_ID

BookingDate

Flight_ID

Normalization
Plane Details
Plane_ID

Flight_ID

Model

Capacity

Flight table
Flight_ID

Departure

Arrival

Total Passenge

Customers Information
Cus_ID

Phone_no

Mailing_address

Payment_Method

Schedule
Schedule_ID

Departure_time

Departure_date

Arrival_time

Arrival_date

Flight_ID

Employee Information
Employee_ID

Employee_job

Flight_ID

Reservation
Cus_ID

F_name

L_name

NIC_no

Nationality

1NF

Gender

Passport_ID

BookingDate

Flight_ID

2NF

These are the normalized tables of airline database.

THANK YOU

Вам также может понравиться