11stst
, 2, 2ndnd
, and 3, and 3rdrd
Normal FormsNormal Forms
ByBy
Carlos AlvaradoCarlos Alvarado
San Jose State UniversitySan Jose State University
OverviewOverview
 Today we’ll talk about:Today we’ll talk about:
 Database NormalizationDatabase Normalization
 Data Anomalies Caused by:Data Anomalies Caused by:
 Update, Insertion, DeletionUpdate, Insertion, Deletion
 Brief History/OverviewBrief History/Overview
 11stst
Normal FormNormal Form
 22ndnd
Normal FormNormal Form
 33rdrd
Normal FormNormal Form
 ConclusionConclusion
Database NormalizationDatabase Normalization
 The main goal of Database NormalizationThe main goal of Database Normalization
is to restructure the logical data model of ais to restructure the logical data model of a
database to:database to:
 Eliminate redundancyEliminate redundancy
 Organize data efficientlyOrganize data efficiently
 Reduce the potential for data anomalies.Reduce the potential for data anomalies.
Data AnomaliesData Anomalies
 Data anomalies are inconsistencies in the dataData anomalies are inconsistencies in the data
stored in a database as a result of an operationstored in a database as a result of an operation
such as update, insertion, and/or deletion.such as update, insertion, and/or deletion.
 Such inconsistencies may arise when have aSuch inconsistencies may arise when have a
particular record stored in multiple locations andparticular record stored in multiple locations and
not all of the copies are updated.not all of the copies are updated.
 We can prevent such anomalies byWe can prevent such anomalies by
implementing 7 different level of normalizationimplementing 7 different level of normalization
called Normal Forms (NF)called Normal Forms (NF)
 We’ll only look at the first three.We’ll only look at the first three. 
Brief History/OverviewBrief History/Overview
 Database Normalization was first proposed by Edgar F.Database Normalization was first proposed by Edgar F.
Codd.Codd.
 Codd defined the first three Normal Forms, which we’llCodd defined the first three Normal Forms, which we’ll
look into, of the 7 known Normal Forms.look into, of the 7 known Normal Forms.
 In order to do normalization we must know what theIn order to do normalization we must know what the
requirements are for each of the three Normal Formsrequirements are for each of the three Normal Forms
that we’ll go over.that we’ll go over.
 One of the key requirements to remember is that NormalOne of the key requirements to remember is that Normal
Forms are progressive. That is, in order to have 3Forms are progressive. That is, in order to have 3rdrd
NFNF
we must have 2we must have 2ndnd
NF and in order to have 2NF and in order to have 2ndnd
NF we mustNF we must
have 1have 1stst
NF.NF.
11stst
Normal FormNormal Form
The RequirementsThe Requirements
 The requirements to satisfy the 1The requirements to satisfy the 1stst
NF:NF:
 Each table has a primary key: minimal set ofEach table has a primary key: minimal set of
attributes which can uniquely identify a recordattributes which can uniquely identify a record
 The values in each column of a table areThe values in each column of a table are
atomic (No multi-value attributes allowed).atomic (No multi-value attributes allowed).
 There are no repeating groups: two columnsThere are no repeating groups: two columns
do not store similar information in the samedo not store similar information in the same
table.table.
11stst
Normal FormNormal Form
ExampleExample
Un-normalized Students table:Un-normalized Students table:
Normalized Students table:Normalized Students table:
Student#Student# AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom ClassClass
11
Class2Class2
123123 123A123A JamesJames 555555 102-8102-8 104-9104-9
124124 123B123B SmithSmith 467467 209-0209-0 102-8102-8
Student#Student# AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom Class#Class#
123123 123A123A JamesJames 555555 102-8102-8
123123 123A123A JamesJames 555555 104-9104-9
124124 123B123B SmithSmith 467467 209-0209-0
124124 123B123B SmithSmith 467467 102-8102-8
22ndnd
Normal FormNormal Form
The RequirementsThe Requirements
 The requirements to satisfy the 2The requirements to satisfy the 2ndnd
NF:NF:
 All requirements for 1All requirements for 1stst
NF must be met.NF must be met.
 Redundant data across multiple rows of aRedundant data across multiple rows of a
table must be moved to a separate table.table must be moved to a separate table.
 The resulting tables must be related to each otherThe resulting tables must be related to each other
by use of foreign key.by use of foreign key.
22ndnd
Normal FormNormal Form
ExampleExampleStudents tableStudents table
Registration tableRegistration table
Student#Student# AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom
123123 123A123A JamesJames 555555
124124 123B123B SmithSmith 467467
Student#Student# Class#Class#
123123 102-8102-8
123123 104-9104-9
124124 209-0209-0
124124 102-8102-8
33rdrd
Normal FormNormal Form
The RequirementsThe Requirements
 The requirements to satisfy the 3The requirements to satisfy the 3rdrd
NF:NF:
 All requirements for 2All requirements for 2ndnd
NF must be met.NF must be met.
 Eliminate fields that do not depend on theEliminate fields that do not depend on the
primary key;primary key;
 That is, any field that is dependent not only on theThat is, any field that is dependent not only on the
primary key but also on another field must beprimary key but also on another field must be
moved to another table.moved to another table.
33rdrd
Normal FormNormal Form
ExampleExample
Students table:Students table:
Student table:Student table: Advisor table:Advisor table:
Student#Student# AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom
123123 123A123A JamesJames 555555
124124 123B123B SmithSmith 467467
Student#Student# AdvIDAdvID
123123 123A123A
124124 123B123B
AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom
123A123A JamesJames 555555
123B123B SmithSmith 467467
33rdrd
Normal FormNormal Form
Example Cont.Example Cont.Students table:Students table:
Registration table:Registration table: Advisor table:Advisor table:
Student#Student# Class#Class#
123123 102-8102-8
123123 104-9104-9
124124 209-0209-0
124124 102-8102-8
AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom
123A123A JamesJames 555555
123B123B SmithSmith 467467
Student#Student# AdvIDAdvID
123123 123A123A
124124 123B123B
ConclusionConclusion
 We have seen how DatabaseWe have seen how Database
Normalization can decrease redundancy,Normalization can decrease redundancy,
increase efficiency and reduce anomaliesincrease efficiency and reduce anomalies
by implementing three of seven differentby implementing three of seven different
levels of normalization called Normallevels of normalization called Normal
Forms. The first three NF’s are usuallyForms. The first three NF’s are usually
sufficient for most small to medium sizesufficient for most small to medium size
applications.applications.
ReferencesReferences
 Hillyer Mike, MySQL AB.Hillyer Mike, MySQL AB. An Introduction to Database NormalizationAn Introduction to Database Normalization,,
http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html,http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html,
accessed October 17, 2006.accessed October 17, 2006.
 Microsoft.Microsoft. Description of the database normalization basicsDescription of the database normalization basics,,
http://support.microsoft.com/kb/283878 , accessed October 17, 2006.http://support.microsoft.com/kb/283878 , accessed October 17, 2006.
 Wikipedia.Wikipedia. Database Normalization.Database Normalization.
http://en.wikipedia.org/wiki/Database_normalization.html , accessed Octoberhttp://en.wikipedia.org/wiki/Database_normalization.html , accessed October
17, 2006.17, 2006.

Roja128

  • 1.
    11stst , 2, 2ndnd ,and 3, and 3rdrd Normal FormsNormal Forms ByBy Carlos AlvaradoCarlos Alvarado San Jose State UniversitySan Jose State University
  • 2.
    OverviewOverview  Today we’lltalk about:Today we’ll talk about:  Database NormalizationDatabase Normalization  Data Anomalies Caused by:Data Anomalies Caused by:  Update, Insertion, DeletionUpdate, Insertion, Deletion  Brief History/OverviewBrief History/Overview  11stst Normal FormNormal Form  22ndnd Normal FormNormal Form  33rdrd Normal FormNormal Form  ConclusionConclusion
  • 3.
    Database NormalizationDatabase Normalization The main goal of Database NormalizationThe main goal of Database Normalization is to restructure the logical data model of ais to restructure the logical data model of a database to:database to:  Eliminate redundancyEliminate redundancy  Organize data efficientlyOrganize data efficiently  Reduce the potential for data anomalies.Reduce the potential for data anomalies.
  • 4.
    Data AnomaliesData Anomalies Data anomalies are inconsistencies in the dataData anomalies are inconsistencies in the data stored in a database as a result of an operationstored in a database as a result of an operation such as update, insertion, and/or deletion.such as update, insertion, and/or deletion.  Such inconsistencies may arise when have aSuch inconsistencies may arise when have a particular record stored in multiple locations andparticular record stored in multiple locations and not all of the copies are updated.not all of the copies are updated.  We can prevent such anomalies byWe can prevent such anomalies by implementing 7 different level of normalizationimplementing 7 different level of normalization called Normal Forms (NF)called Normal Forms (NF)  We’ll only look at the first three.We’ll only look at the first three. 
  • 5.
    Brief History/OverviewBrief History/Overview Database Normalization was first proposed by Edgar F.Database Normalization was first proposed by Edgar F. Codd.Codd.  Codd defined the first three Normal Forms, which we’llCodd defined the first three Normal Forms, which we’ll look into, of the 7 known Normal Forms.look into, of the 7 known Normal Forms.  In order to do normalization we must know what theIn order to do normalization we must know what the requirements are for each of the three Normal Formsrequirements are for each of the three Normal Forms that we’ll go over.that we’ll go over.  One of the key requirements to remember is that NormalOne of the key requirements to remember is that Normal Forms are progressive. That is, in order to have 3Forms are progressive. That is, in order to have 3rdrd NFNF we must have 2we must have 2ndnd NF and in order to have 2NF and in order to have 2ndnd NF we mustNF we must have 1have 1stst NF.NF.
  • 6.
    11stst Normal FormNormal Form TheRequirementsThe Requirements  The requirements to satisfy the 1The requirements to satisfy the 1stst NF:NF:  Each table has a primary key: minimal set ofEach table has a primary key: minimal set of attributes which can uniquely identify a recordattributes which can uniquely identify a record  The values in each column of a table areThe values in each column of a table are atomic (No multi-value attributes allowed).atomic (No multi-value attributes allowed).  There are no repeating groups: two columnsThere are no repeating groups: two columns do not store similar information in the samedo not store similar information in the same table.table.
  • 7.
    11stst Normal FormNormal Form ExampleExample Un-normalizedStudents table:Un-normalized Students table: Normalized Students table:Normalized Students table: Student#Student# AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom ClassClass 11 Class2Class2 123123 123A123A JamesJames 555555 102-8102-8 104-9104-9 124124 123B123B SmithSmith 467467 209-0209-0 102-8102-8 Student#Student# AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom Class#Class# 123123 123A123A JamesJames 555555 102-8102-8 123123 123A123A JamesJames 555555 104-9104-9 124124 123B123B SmithSmith 467467 209-0209-0 124124 123B123B SmithSmith 467467 102-8102-8
  • 8.
    22ndnd Normal FormNormal Form TheRequirementsThe Requirements  The requirements to satisfy the 2The requirements to satisfy the 2ndnd NF:NF:  All requirements for 1All requirements for 1stst NF must be met.NF must be met.  Redundant data across multiple rows of aRedundant data across multiple rows of a table must be moved to a separate table.table must be moved to a separate table.  The resulting tables must be related to each otherThe resulting tables must be related to each other by use of foreign key.by use of foreign key.
  • 9.
    22ndnd Normal FormNormal Form ExampleExampleStudentstableStudents table Registration tableRegistration table Student#Student# AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom 123123 123A123A JamesJames 555555 124124 123B123B SmithSmith 467467 Student#Student# Class#Class# 123123 102-8102-8 123123 104-9104-9 124124 209-0209-0 124124 102-8102-8
  • 10.
    33rdrd Normal FormNormal Form TheRequirementsThe Requirements  The requirements to satisfy the 3The requirements to satisfy the 3rdrd NF:NF:  All requirements for 2All requirements for 2ndnd NF must be met.NF must be met.  Eliminate fields that do not depend on theEliminate fields that do not depend on the primary key;primary key;  That is, any field that is dependent not only on theThat is, any field that is dependent not only on the primary key but also on another field must beprimary key but also on another field must be moved to another table.moved to another table.
  • 11.
    33rdrd Normal FormNormal Form ExampleExample Studentstable:Students table: Student table:Student table: Advisor table:Advisor table: Student#Student# AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom 123123 123A123A JamesJames 555555 124124 123B123B SmithSmith 467467 Student#Student# AdvIDAdvID 123123 123A123A 124124 123B123B AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom 123A123A JamesJames 555555 123B123B SmithSmith 467467
  • 12.
    33rdrd Normal FormNormal Form ExampleCont.Example Cont.Students table:Students table: Registration table:Registration table: Advisor table:Advisor table: Student#Student# Class#Class# 123123 102-8102-8 123123 104-9104-9 124124 209-0209-0 124124 102-8102-8 AdvIDAdvID AdvNameAdvName AdvRoomAdvRoom 123A123A JamesJames 555555 123B123B SmithSmith 467467 Student#Student# AdvIDAdvID 123123 123A123A 124124 123B123B
  • 13.
    ConclusionConclusion  We haveseen how DatabaseWe have seen how Database Normalization can decrease redundancy,Normalization can decrease redundancy, increase efficiency and reduce anomaliesincrease efficiency and reduce anomalies by implementing three of seven differentby implementing three of seven different levels of normalization called Normallevels of normalization called Normal Forms. The first three NF’s are usuallyForms. The first three NF’s are usually sufficient for most small to medium sizesufficient for most small to medium size applications.applications.
  • 14.
    ReferencesReferences  Hillyer Mike,MySQL AB.Hillyer Mike, MySQL AB. An Introduction to Database NormalizationAn Introduction to Database Normalization,, http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html,http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html, accessed October 17, 2006.accessed October 17, 2006.  Microsoft.Microsoft. Description of the database normalization basicsDescription of the database normalization basics,, http://support.microsoft.com/kb/283878 , accessed October 17, 2006.http://support.microsoft.com/kb/283878 , accessed October 17, 2006.  Wikipedia.Wikipedia. Database Normalization.Database Normalization. http://en.wikipedia.org/wiki/Database_normalization.html , accessed Octoberhttp://en.wikipedia.org/wiki/Database_normalization.html , accessed October 17, 2006.17, 2006.