0% found this document useful (0 votes)
47 views34 pages

PCIT 02 Chapter 3 of Fundamental of Database System

Uploaded by

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

PCIT 02 Chapter 3 of Fundamental of Database System

Uploaded by

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

Fundamental of Database

System
Chapter 3
Normalization Basics
EMILVERCHRISTIAN V. ARQUERO

CENTRAL PHILIPPINES STATE UNIVERSITY


Chapter 3:
Normalization Basics
 Description of normalization
 First normal form
 Second normal form
 Third normal form
 Other Normalization form

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Normalization
Normalization is the process of organizing data in a database. This
includes creating tables and establishing relationships between those
tables according to rules designed both to protect the data and to
make the database more flexible by eliminating redundancy and
inconsistent dependency.

Redundant data wastes disk space and creates maintenance


problems. If data that exists in more than one place must be changed,
the data must be changed in exactly the same way in all locations.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


What is an "inconsistent dependency"?
Inconsistent dependencies can make data difficult to access because
the path to find the data may be missing or broken.

It leads users to search the data in the wrong table, resulting in an


error as an output.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Normalization
If a database design is not perfect, it may contain anomalies, which
are like a bad dream for any database administrator. Managing a
database with anomalies is next to impossible.
Update anomalies − If data items are scattered and are not linked to
each other properly, then it could lead to strange situations.
Deletion anomalies − We tried to delete a record, but parts of it was
left undeleted because of unawareness, the data is also saved
somewhere else.
Insert anomalies − We tried to insert data in a record that does not
exist at all.
EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM
Normalization
There are a few rules for database normalization. Each rule is
called a "normal form." If the first rule is observed, the database
is said to be in "first normal form." If the first three rules are
observed, the database is considered to be in "third normal
form." Although other levels of normalization are possible, third
normal form is considered the highest level necessary for most
applications.
First normal form Second normal form
Third normal form Boyce Codd Normal Form (BCNF)

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Advantages of Normalization
 Normalization helps to minimize data redundancy.
 Greater overall database organization.
 Data consistency within the database.
 Much more flexible database design.
 Enforces the concept of relational integrity.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Disadvantages of Normalization
 You cannot start building the database before knowing what the
user needs.
 The performance degrades when normalizing the relations to
higher normal forms, i.e., 4NF, 5NF.
 It is very time-consuming and difficult to normalize relations of a
higher degree.
 Careless decomposition may lead to a bad database design, leading
to serious problems.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Normalization

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


First Normal Form
First Normal Form is defined in the definition of relations (tables)
itself. This rule defines that all the attributes in a relation must have
atomic domains.
 Eliminate repeating groups in individual tables.
 Create a separate table for each set of related data.
 Identify each set of related data with a primary key.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


First Normal Form

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Normalization

Prime attribute − An attribute, which is a part of the candidate-key, is


known as a prime attribute.

Non-prime attribute − An attribute, which is not a part of the prime-


key, is said to be a non-prime attribute.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Second Normal Form
If we follow second normal form, then every non-prime attribute
should be fully functionally dependent on prime key attribute.

 Create separate tables for sets of values that apply to multiple


records.
 Relate these tables with a foreign key.

Records should not depend on anything other than a table's primary


key (a compound key, if necessary).

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Second Normal Form

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


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

 Eliminate fields that do not depend on the key.

Values in a record that are not part of that record's key do not
belong in the table. In general, anytime the contents of a group
of fields may apply to more than a single record in the table,
consider placing those fields in a separate table.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Third Normal Form

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Other normalization forms
Fourth normal form, also called Boyce Codd Normal Form
(BCNF), and fifth normal form do exist, but are rarely considered
in practical design. Disregarding these rules may result in less
than perfect database design, but should not affect
functionality.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Example Unnormalized Database

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Step 1: First Normal Form 1NF

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Step 2: Second Normal Form 2NF

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Step 3: Third Normal Form 3NF

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Normalized database

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


DBMS Keys
 Keys play an important role in the relational database.
 It is used to uniquely identify any record or row of data from the
table. It is also used to establish and identify relationships
between tables.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


DBMS Keys
For example, ID is used as a key in the Student table because it is
unique for each student. In the PERSON table, passport_number,
license_number, SSN are keys since they are unique for each person.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


Types of keys

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


DBMS Keys
Primary key
 It is the first key used to identify one
and only one instance of an entity
uniquely.
 In the EMPLOYEE table, ID can be the
primary key since it is unique for each
employee. In the EMPLOYEE table, we
can even select License_Number and
Passport_Number as primary keys
since they are also unique.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


DBMS Keys
Candidate key
 A candidate key is an attribute or set
of attributes that can uniquely
identify a tuple.
 Except for the primary key, the
remaining attributes are considered
a candidate key. The candidate keys
are as strong as the primary key.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


DBMS Keys
Super Key
Super key is an attribute set that can
uniquely identify a tuple. A super key is
a superset of a candidate key.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


DBMS Keys
Foreign key
Foreign keys are the column of the
table used to point to the primary key
of another table.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


DBMS Keys
Alternate key
There may be one or more attributes or
a combination of attributes that
uniquely identify each tuple in a
relation. These attributes or
combinations of the attributes are
called the candidate keys. One key is
chosen as the primary key from these
candidate keys, and the remaining
candidate key, if it exists, is termed the
alternate key.
EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM
DBMS Keys
Composite key
Whenever a primary key consists of
more than one attribute, it is known as
a composite key. This key is also known
as Concatenated Key.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


DBMS Keys
Composite key
Whenever a primary key consists of
more than one attribute, it is known as
a composite key. This key is also known
as Concatenated Key.

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM


DBMS Keys
Artificial key
The key created using arbitrarily assigned data are known as artificial
keys. These keys are created when a primary key is large and complex
and has no relationship with many other relations. The data values of
the artificial keys are usually numbered in a serial order.

For example, the primary key, which is composed of Emp_ID,


Emp_role, and Proj_ID, is large in employee relations. So it would be
better to add a new virtual attribute to identify each tuple in the
relation uniquely.
EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM
Unnormalized Form (UNF)

EMILVERCHRISTIAN V. ARQUERO, MIT FUNDAMENTAL OF DATABASE SYSTEM

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy