0% found this document useful (0 votes)
16 views27 pages

DBD261 SLID 03 Normalization

The document discusses database normalization, which is a formal approach to organizing data to minimize redundancy and data anomalies. It outlines the normalization process, including the definitions and steps for achieving first, second, and third normal forms, as well as the importance of keys and dependencies in database design. Additionally, it addresses the concepts of denormalization and its implications on database efficiency and performance.

Uploaded by

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

DBD261 SLID 03 Normalization

The document discusses database normalization, which is a formal approach to organizing data to minimize redundancy and data anomalies. It outlines the normalization process, including the definitions and steps for achieving first, second, and third normal forms, as well as the importance of keys and dependencies in database design. Additionally, it addresses the concepts of denormalization and its implications on database efficiency and performance.

Uploaded by

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

1

Database design
Belgium Campus – DBD261 – lesson 3

© BELGIUM CAMPUS 2021


2

NormaliZation

© BELGIUM CAMPUS 2021


3

Normalization
THE FORMAL APPROACH TO APPLYING A SET OF RULES USED TO ASSOCIATE ATTRIBUTES WITH ENTITIES.

BENEFITS

Dependencies Redundant data is The data model is


between data are minimized. flexible and easier to
identified. maintain.

© BELGIUM CAMPUS 2021


Normalization
• Evaluating and correcting table structures to minimize data
redundancies
• Reduces data anomalies
• Assigns attributes to tables based on determination
• Normal forms
• First normal form (1NF)
• Second normal form (2NF)
• Third normal form (3NF)

4
www.belgiumcampus.ac.za
Data Redundancy
• Unnecessarily storing same data at different places
• Islands of information: Scattered data locations
• Increases the probability of having different versions of the same data

55
www.belgiumcampus.ac.za
Normalization Process
• Objective is to ensure that each table conforms to the concept of
well-formed relations
• Each table represents a single subject
• No data item will be unnecessarily stored in more than one table
• All non-key attributes in a table are dependent on the primary key
• Each table is void of insertion, update, and deletion anomalies

6
www.belgiumcampus.ac.za
Data ANOMALIES
• The dictionary defines anomaly as “an abnormality.”
• Ideally, a field value change should be made in only a single place.
• Data redundancy, however, fosters an abnormal condition by forcing
field value changes in many different locations

7
www.belgiumcampus.ac.za
Types of Data Anomaly
Update Anomalies

Insertion Anomalies

Deletion Anomalies

88
www.belgiumcampus.ac.za
Types of Data
Anomaly
• Update Anomaly – changes ENO NAME BRANCH HOD OFFICE_TEL
to OFFICE_TEL of branch CSE
requires updates to all 401 Akon CSE Mr. X 53337
instances of CSE
402 Bkon CSE Mr. X 53337
• Insertion Anomaly – adding a
new branch require values 403 Ckon CSE Mr. X 53337
for employee number (ENO) 404 Dkon CSE Mr. X 53337
and NAME.
405 Ekon MCE Mr. Y 53330
• Deletion Anomaly – deleting
employee 405 will also
delete branch MCE • What other problems can you identify with this table?
• Classify each of the problems as an Update, Insertion
or Deletion anomaly

9 9
www.belgiumcampus.ac.za
Keys
• Consist of one or more attributes that determine other attributes
• Used to:
• Ensure that each row in a table is uniquely identifiable
• Establish relationships among tables and to ensure the integrity of the data
• Primary key (PK): Attribute or combination of attributes that
uniquely identifies any given row

10
10
www.belgiumcampus.ac.za
Determination
• State in which knowing the value of one attribute makes it possible to
determine the value of another
• Is the basis for establishing the role of a key
• Based on the relationships among the attributes

11
11
www.belgiumcampus.ac.za
Dependencies
• Functional dependence: Value of one or more attributes determines
the value of one or more other attributes
• Determinant: Attribute whose value determines another
• Dependent: Attribute whose value is determined by the other attribute
• Full functional dependence: Entire collection of attributes in the
determinant is necessary for the relationship

12
12
www.belgiumcampus.ac.za
Types of Functional Dependencies
• Partial dependency: Functional dependence in which the
determinant is only part of the primary key
• Assumption - One candidate key
• Straight forward
• Easy to identify
• Transitive dependency: An attribute functionally depends on another
non-key attribute

13
www.belgiumcampus.ac.za
Normalization Process
• Ensures that all tables are in at least 3NF
• Higher forms are not likely to be encountered in business
environment
• Works one relation at a time
• Starts by:
• Identifying the dependencies of a relation (table)
• Progressively breaking the relation into new set of relations

14
www.belgiumcampus.ac.za
15

Zero normal Fullname


form BillingAddress

City

Before we start the WE WILL BE DESIGNING A PostalCode


normalization steps, we
look at our question and DATABASE THAT WILL KEEP HostelName
list all the attributes we TRACK OF OUR STUDENTS. HostelAddress
will need in our
database. HostelRoomNumber

DegreeName

DegreeWhenEarned

DegreeInProgress
Conversion to First Normal Form
• Repeating group: Group of multiple entries of same type can exist for
any single key attribute occurrence
• Existence proves the presence of data redundancies
• Enable reducing data redundancies
• Steps
• Eliminate the repeating groups
• Identify the primary key
• Identify all dependencies

16
www.belgiumcampus.ac.za
17

Student
StudentID

First Firstname
Lastname

normal MiddelInitial
BillingAddress1 Student

Taken to first normal form


form
BillingCity StudentID
StudentID
BillingProvince Firstname
BillingPostCode Lastname
HostelID MiddelInitial
StudentDegree
HostelName BillingAddress1
An entity is in the first StudentID (FK)
StudentID(FK)
HostelStreet BillingCity
normal form if it contains DegreeID
HostelPhone BillingProvince
no repeating groups. DegreeName
HostelRoomNumber BillingPostCode
DegreeWhenEarned
DegreeID1 HostelID
It is possible that a DegreeInProgress
DegreeName1 HostelName
Student can possess
DegreeWhenEarned1 HostelStreet
many degrees.
DegreeInProgress1 HostelRoomNumber

In that case, the degree DegreeID2

attributes will repeat for DegreeName2

every degree. DegreeWhenEarned2


DegreeInProgress2
Conversion to Second Normal Form
• Steps
• Make new tables to eliminate partial dependencies
• Reassign corresponding dependent attributes
• Table is in 2NF when it:
• Is in 1NF
• Includes no partial dependencies

18
www.belgiumcampus.ac.za
19

Student

Second StudentID(PK)

normal
Firstname

Lastname

form MiddelInitial
StudentDegree

StudentID (FK)
BillingAddress1
DegreeID (FK) Degree
BillingCity
A relationship is in the DegreeID (PK)
BillingProvince
second normal form
(2NF) if it is in the first BillingPostCode
In the StudentDegree table DegreeName

normal form, and all of we now have what we call a


DegreeWhenEarned
its attributes depend on HostelID composite primary key.
DegreeInProgress
the whole primary key. HostelName

HostelStreet

HostelPhone

HostelRoomNumber
Conversion to Third Normal Form
• Steps
• Make new tables to eliminate transitive dependencies
• Determinant: Any attribute whose value determines other values within a row
• Reassign corresponding dependent attributes
• Table is in 3NF when it:
• Is in 2NF
• Contains no transitive dependencies

20
www.belgiumcampus.ac.za
21

Student
Third StudentID(PK) Degree

normal Firstname

Lastname
StudentDegree

StudentID (FK)
DegreeID (PK)

DegreeName

form MiddelInitial DegreeID (FK)


DegreeWhenEarned
BillingAddress1
DegreeInProgress
BillingAddress2
A relationship is in the
BillingCity
third normal form (3NF) if Hostel
all the attributes are non- BillingProvince
transitively dependent HostelID
BillingPostCode
on the primary key.
HostelName
HostelID(FK)
HostelStreet

HostelRoomNumber
Normalization and Database Design
• Normalization should be part of the design process
• Proposed entities must meet required the normal form before table
structures are created
• Principles and normalization procedures to be understood to redesign
and modify databases
• ERD is created through an iterative process
• Normalization focuses on the characteristics of specific entities

22
www.belgiumcampus.ac.za
Denormalization
• Design goals
• Creation of normalized relations
• Processing requirements and speed
• Number of database tables expands when tables are decomposed to
conform to normalization requirements
• Joining a larger number of tables:
• Takes additional input/output (I/O) operations and processing logic
• Reduces system speed

23
www.belgiumcampus.ac.za
Denormalization
• Defects in unnormalized tables
• Data updates are less efficient because tables are larger
• Indexing is more cumbersome
• No simple strategies for creating virtual tables known as views

24
www.belgiumcampus.ac.za
DISCUSSION
• Discuss the motivation for and against de-normalizing a database.

25
www.belgiumcampus.ac.za
26

Activity
Complete DBD2x1 Activity 2 -
Normalization

© BELGIUM CAMPUS 2021


27

GET READY
Download and install SQL Server
Express edition on your PC

If not included, also download and


install SQL Server Management Studio

© BELGIUM CAMPUS 2021

You might also like