0% found this document useful (0 votes)
16 views

Database Normalization - New

The document discusses database normalization and its goals. Normalization is the process of organizing data to minimize redundancy. It defines several normal forms including 1NF, 2NF, 3NF and BCNF. The document provides examples to illustrate how to normalize relations by removing transitive dependencies and organizing data into multiple tables.

Uploaded by

VOJE DIF
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Database Normalization - New

The document discusses database normalization and its goals. Normalization is the process of organizing data to minimize redundancy. It defines several normal forms including 1NF, 2NF, 3NF and BCNF. The document provides examples to illustrate how to normalize relations by removing transitive dependencies and organizing data into multiple tables.

Uploaded by

VOJE DIF
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Database Normalization:

Database normalization is the process of organizing the fields and tables of a relational
database to minimize redundancy.

Normalization usually involves dividing large tables into smaller (and less redundant)
tables and defining relationships between them.

The objective is to isolate data so that additions, deletions, and modifications of a field
can be made in just one table and then propagated through the rest of the database
using the defined relationships.

E F. Codd, the inventor of the relational model, introduced the concept of


normalization and what we now know as the First Normal Form (1NF) in 1970.

Codd went on to define the Second Normal Form (2NF) and Third Normal Form (3NF)
in 1971.

Codd and Raymond F. Boyce defined the Boyce-Codd Normal Form (BCNF) in 1974.

First Normal Form (1NF):


A row of data cannot contain repeating group of data i.e each column must have a
unique value.

Each row of data must have a unique identifier i.e Primary key. For example consider a
table which is not in First normal form.

1. There's no top-to-bottom ordering to the rows.


2. There's no left-to-right ordering to the columns.
3. There are no duplicate rows.
4. Every row-and-column intersection contains exactly one value from the
applicable domain (and nothing else).
5. All columns are regular [i.e. rows have no hidden components such as
row IDs, object IDs, or hidden timestamps].
Example of 1NF :

[Unorganized relation]

We re-arrange the relation (table) as below, to convert it to First Normal Form

[ Relation in 1NF ]
Second Normal Form:
Before we learn about second normal form, we need to understand the following:

Prime attribute: an attribute, which is part of prime-key, is prime attribute.

Non-prime attribute: an attribute, which is not a part of prime-key, is said to


be a non-prime attribute.
Second normal form says, that every non-prime attribute should be fully functionally
dependent on prime key attribute.

That is, if X → A holds, then there should not be any proper subset Y of X, for that Y →
A also holds.

[Relation not in 2NF]

We see here in Student_Project relation that the prime key attributes are Stu_ID and
Proj_ID.

According to the rule, non-key attributes, i.e. Stu_Name and Proj_Name must be
dependent upon both and not on any of the prime key attribute individually. But we
find that Stu_Name can be identified by Stu_ID and Proj_Name can be identified by
Proj_ID independently. This is called partial dependency, which is not allowed in
Second Normal Form.

[Relation in 2NF]

We broke the relation in two as depicted in the above picture. So there exists no partial
dependency.
Third Normal Form:

Transitive dependency
A transitive dependency is an indirect functional dependency, one in
which X→Z only by virtue of X→Y and Y→Z.

Trivial functional dependency


A trivial functional dependency is a functional dependency of an attribute on a
superset of itself. {Employee ID, Employee Address} → {Employee Address} is
trivial, as is {Employee Address} → {Employee Address}.

Super key
A superkey is a combination of attributes that can be used to uniquely identify a
database record. A table might have many superkeys.

For a relation to be in Third Normal Form, it must be in Second Normal form and the
following must satisfy:

No non-prime attribute is transitively dependent on prime key attribute

For any non-trivial functional dependency, X → A, then either

X is a super key or.

A is prime attribute.
[Relation not in 3NF]

We find that in above depicted Student_detail relation, Stu_ID is key and only prime
key attribute.

We find that City can be identified by Stu_ID as well as Zip itself. Neither Zip is a
superkey nor City is a prime attribute. Additionally, Stu_ID → Zip → City, so there
exists transitive dependency.

[Image: Relation in 3NF]


We broke the relation as above depicted two relations to bring it into 3NF.
Summary of Normalization Rules

That is the complete process. Having started off with an unnormalized table we
finished with four normalized tables in 3NF. You will notice that duplication has been
removed (apart from the keys needed to establish the links between those tables).

The process may look complicated. However, if you follow the rules completely,
and do not miss out any steps, then you should arrive at the correct solution. If you
omit a rule there is a high probability that you will end up with too few tables or
incorrect keys.

The following normal forms were discussed in this section:

1. First normal form: A table is in the first normal form if it contains no


repeating columns.

2. Second normal form: A table is in the second normal form if it is in the first
normal form and contains only columns that are dependent on the whole
(primary) key.

3. Third normal form: A table is in the third normal form if it is in the second
normal form and all the non-key columns are dependent only on the primary
key. If the value of a non-key column is dependent on the value of another non-
key column we have a situation known as transitive dependency. This can be
resolved by removing the columns dependent on non-key items to another table.
Solve this Example:
Q. Convert below table in Normal Form.

UNF

Lecturer Number , Lecturer Name, Lecturer Grade, Department Code, Department


Name, Subject Code, Subject Name, Subject Level

Answer:

1NF

Lecturer Number, Lecturer Name, Lecturer Grade, Department Code, Department


Name

Lecturer Number, Subject Code, Subject Name, Subject Level

2NF

Lecturer Number, Lecturer Name, Lecturer Grade, Department Code, Department


Name

Lecturer Number, Subject Code

Subject Code, Subject Name, Subject Level

3NF

Department Code, Department Name

Lecturer Number, Lecturer Name, Lecturer Grade, Department Code

Subject Code, Subject Name, Subject Level

Lecturer Number, Subject

You might also like