0% found this document useful (0 votes)
15 views6 pages

Cape Notes Unit 2 Module 1 Content 10

Uploaded by

twitchnemesisfn
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)
15 views6 pages

Cape Notes Unit 2 Module 1 Content 10

Uploaded by

twitchnemesisfn
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/ 6

Normalization

We discuss four normal forms: first, second, third, and Boyce-Codd normal forms
1NF, 2NF, 3NF, and BCNF. Normalization is a process that “improves” a database design by
generating relations that are of higher normal forms. The objective of normalization:
“to create relations where every dependency is on the key, the whole key, and nothing but the
key”.

We consider a relation in BCNF to be fully normalized. The benefit of higher normal forms is
that update semantics for the affected data are simplified. This means that applications required
to maintain the database are simpler.
A design that has a lower normal form than another design has more redundancy. Uncontrolled
redundancy can lead to data integrity problems.
First we introduce the concept of functional dependency.
Functional Dependencies
We say an attribute, B, has a functional dependency on another attribute, A, if for any two
records, which have
the same value for A, then the values for B in these two records must be the same. We illustrate
this as:
A→B
Example: Suppose we keep track of employee email addresses, and we only track one email
address for each employee. Suppose each employee is identified by their unique employee
number. We say there is a functional dependency of email address on employee number:
employee number → email address
Example:

EmpNum EmpEmail EmpFname EmpLname


123 [email protected] John Doe
456 [email protected] Peter Smith
555 [email protected] Alan Lee
633 [email protected] Peter Doe
787 [email protected] Alan Lee

If EmpNum is the PK then the FDs:


EmpNum → EmpEmail
EmpNum → EmpFname
EmpNum → EmpLname
Must exist!
2 different ways you might see FDs depicted
EmpNum → EmpEmail
EmpNum → EmpFname
EmpNum → EmpLname

EmpEmail
EmpNum EmpFname

EmpLname

Functional Dependency
EmpNum → EmpEmail
Attribute on the LHS is known as the determinant
• EmpNum is a determinant of EmpEmail

Transitive dependency
• Consider attributes A, B, and C, and where
• A → B and B → C.
• Functional dependencies are transitive, which means that we also have the functional
dependency A → C
• We say that C is transitively dependent on A through B.

Partial Dependency
A partial dependency exists when an attribute B is functionally dependent on an attribute A,
and A is a component of a multipart candidate key.
Steps in Normalization
Unnormalized Form (UNF)
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.
First Normal Form – 1NF
We say a relation is in 1NF if all values stored in the relation are single-valued and atomic.
1NF places restrictions on the structure of relations. Values must be simple. A relation in which
intersection of each row and column contains one and only one value.
Steps:
1. Nominate an attribute or group of attributes to act as the key for the unnormalized table.
2. Identify repeating group(s) in unnormalized table which repeats for the key attribute(s).
3. Remove repeating group by:
• entering appropriate data into the empty columns of rows containing
repeating data (‘flattening’ the table).
Or by:
• placing repeating data along with copy of the original key attribute(s) into
a separate relation.
Second Normal Form (2NF)
A relation is in 2NF if it is in 1NF, and every non-key attribute is fully dependent on each
candidate key. (That is, we don’t have any partial functional dependency.)
• 2NF (and 3NF) both involve the concepts of key and non-key attributes.
• A key attribute is any attribute that is part of a key; any attribute that is not a key
attribute, is a non-key attribute.
• A relation in 2NF will not have any partial dependencies
Third Normal Form – 3NF
A relation is in 3NF if the relation is in 1NF and 2NF and all determinants of non-key attributes
are candidate keys.
That is, for any functional dependency: X → Y, where Y is a non-key attribute (or a set of non-
key attributes), X is a candidate key.
A relation in 3NF will not have any transitive dependencies of non-key attribute on a candidate
key through another non-key attribute, i.e.: no primary key attribute is transitively dependent
on any primary key.

You might also like