0% found this document useful (0 votes)
32 views29 pages

Normalisation

1. Normalization is a technique for organizing data in a database to minimize redundancy and dependency. It involves decomposing tables to eliminate anomalies like insertion, deletion and modification anomalies. 2. The goals of normalization are to ensure that each table represents a single "entity" and that fields in the tables depend on the primary key. This is achieved through normal forms like 1NF, 2NF, 3NF and BCNF. 3. The normalization process starts by converting an unnormalized table to first normal form, then second normal form by removing partial dependencies, and third normal form by removing transitive dependencies. Each step aims to simplify tables and eliminate anomalies.

Uploaded by

tayebwaezra4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views29 pages

Normalisation

1. Normalization is a technique for organizing data in a database to minimize redundancy and dependency. It involves decomposing tables to eliminate anomalies like insertion, deletion and modification anomalies. 2. The goals of normalization are to ensure that each table represents a single "entity" and that fields in the tables depend on the primary key. This is achieved through normal forms like 1NF, 2NF, 3NF and BCNF. 3. The normalization process starts by converting an unnormalized table to first normal form, then second normal form by removing partial dependencies, and third normal form by removing transitive dependencies. Each step aims to simplify tables and eliminate anomalies.

Uploaded by

tayebwaezra4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

Normalization

1
Objectives

Purpose of normalization
Update anomalies
Normalization process

2
Normalization
The main objective in developing a
logical data model for relational
database systems is to create an
accurate representation of the data, its
relationships, and constraints.

To achieve this objective, one must


form a suitable set of relations.

Normalization provides a bottom-up


approach to database design.

3
Purpose of Normalization
Normalization is a technique for producing a
set of relations with desirable properties
given the data requirements of an enterprise.

Most commonly used “normal forms” are


first (1NF), second (2NF), third (3NF) normal
forms and Boyce–Codd normal form (BCNF).

These are based on functional dependencies


among the attributes of a relation.

The main purpose of normalization is to


ensure that relations are in a specific form to
prevent possible occurrence of update
anomalies. 4
Data Redundancy
Major aim of relational database design is to
group attributes into relations to minimize
data redundancy and reduce file storage
space required by base relations.

Problems associated with data redundancy


are illustrated by comparing the following
Staff and Branch relations with the
StaffBranch relation.

5
Data Redundancy

6
Update Anomalies
Relations that contain redundant (duplicate)
information may potentially suffer from
update anomalies.

Types of update anomalies include:


Insertion
Deletion
Modification

7
Lossless-join and Dependency
Preservation Properties
 Two important properties of decomposition:
- Lossless-join property enables us to find any
instance of original relation from
corresponding instances in the smaller
relations.
- Dependency preservation property enables
us to enforce a constraint on original relation
by enforcing some constraint on each of the
smaller relations.
8
Functional Dependency
It is the main concept associated with
normalization; our aim is identifying the
functional dependencies in a relation.
Functional Dependency
Describes relationship between attributes in a
relation.
If A and B are attributes of relation R, B is
functionally dependent on A (denoted A  B or
A B), if each value of A in R is associated
with exactly one value of B in R.

9
Example
branchNo bAddress

10
Example - Functional Dependency

11
The Process of Normalization
Formal technique for analyzing a relation based
on its primary key and functional dependencies
between its attributes.

Often executed as a series of steps. Each step


corresponds to a specific normal form, which
has known properties.

As normalization proceeds, relations become


progressively more restricted in format and less
vulnerable to update anomalies.

12
Relationship Between Normal
Forms

13
Unnormalized Form (UNF)

A relation in UNF is A table that


contains one or more repeating
groups.

To create an unnormalized table:


transform data from information source
(e.g. form) into table format with columns
and rows, without any attention to
redundancy and format.
14
Goal — To devise a guiding theory for
the Following

Decide whether a particular relation R


is in “good” form.
In the case that a relation R is not in
“good” form, decompose it into a set
of relations {R1, R2, ..., Rn} such that;
each relation is in good form
the decomposition is a lossless-join
decomposition
15
First Normal Form
A Domain is atomic if its elements are
considered to be indivisible units.
A relation in 1NF is one whose intersection
of each row and column contains one and
only one value.
Examples of non-atomic domains:
Set of names, composite attributes
Identification numbers like CS101 that
can be broken up into parts
A relational schema R is in first normal form
if the domains of all attributes of R are
atomic 16
First Normal Form (Cont’d)
Non-atomic values complicate storage and
encourage redundant (repeated) storage of
data
Example: Set of accounts stored with each
customer, and set of owners stored with
each account
Atomicity is actually a property of how the
elements of the domain are used.
Example: Strings (words) would normally be
considered indivisible
Suppose that students are given roll
numbers which are strings of the form
CS0012 or EE1127 17
First Normal Form (1NF)

If the first two characters can be


extracted to find the department, the
domain of roll numbers is not atomic.

In 1NF the desired goal theory is


based on:
functional dependencies
Multi-valued dependencies

18
UNF to 1NF
There are two approaches to converting
an unnormalized table into the 1NF
“Flattening” the table.
Entering appropriate data into the empty
columns of rows containing the repeating
groups. This is known as
Decomposition.
‘Placing the repeated data together with a
copy of the original primary key in a
separate relation i.e. by creating a new
relation.
19
UNF to 1NF
Nominate an attribute or group of attributes
to act as the key for the unnormalized table.

Identify repeating group(s) in unnormalized


table which repeats for the key attribute(s).

Remove repeating group by either approach


mentioned above. (The second approach
gives rise to a less redundancy.)

20
UNF to 1NF

Using the 1st approach


Fill in the empty columns
Select the possible candidate keys
Select Primary Key

Using the 2nd approach


Create a separate relation for the
repeating group i.e. the repeating data
together with a copy of the primary key.

21
Second Normal Form (2NF)
Based on concept of full functional dependency:
If A and B are attributes of a relation,
B is fully dependent on A if B is
functionally dependent on A but not on
any proper subset of A.

2NF - A relation that is in 1NF and every


non-primary-key attribute is fully functionally
dependent on the primary key.

22
1NF to 2NF
This involves the removal of partial
dependencies e.g. in the clientRental
relation.
Identify functional dependencies in the
relation both partial and full considering
a pair of attributes where one is the
primary key (or a subset of the primary
key).

23
1NF to 2NF
• A relation schema R is in second
normal form (2NF) if every non-
prime attribute A in R is fully
functionally dependent on the
primary key

• This applies to relations where the


primary key is composite

24
Review of Normalization (UNF to BCNF)

25
Review of Normalization (UNF to BCNF)

26
Third Normal Form (3NF)
Based on concept of transitive dependency:
A, B and C are attributes of a relation such
that if A  B and B  C,
then C is transitively dependent on A through
B. (Provided that A is not functionally
dependent on B or C).

3NF - A relation that is in 1NF and 2NF


and in which no non-primary-key attribute
is transitively dependent on the primary
key attribute.
27
2NF to 3NF
Identify the primary key in the 2NF
relation.
Identify functional dependencies in the
relation.
If transitive dependencies exist on the
primary key remove them by placing
them in a new relation along with copy
of their determinant.

28
General Definitions of 2NF and
3NF
Second normal form (2NF)
A relation that is in 1NF and every non-
primary-key attribute is fully functionally
dependent on any candidate key.

Third normal form (3NF)


A relation that is in 1NF and 2NF and in
which no non-primary-key attribute is
transitively dependent on any candidate key.

29

You might also like