SlideShare a Scribd company logo
1 of 20
Download to read offline
Database Management
Systems
Data Modelling Part 2
Normalization
By Nickkisha Farrell, BSc IT, Dip Ed
February 2014
IN THIS PRESENTATION
Entity and Referential Integrity
Physical Database Design: tables, primary keys, foreign keys
Normalization - 1st , 2nd , 3rd Normal Forms
Top-down versus Bottom-up Design

2
TABLES / RELATIONS
When creating a table also called a relation:
• Each attribute value must be a single value only.
• All values for a given attribute must be of the same data type.
• Each attribute (column) name must be unique.
• The order of attributes (columns) is insignificant
• No two tuples (rows) in a relation should be identical.
• The order of the tuples (rows) is insignificant.

3
ENTITY AND REFERENTIAL INTEGRITY
• An Entity typically corresponds to a relation.
• Thus an entity’s attributes become attributes of the
relation.
• These attributes are represented by columns in a
relation

4
KEYS
• Keys play a very important role in relational databases. They
are used to establish and identify relationships between
tables. They are also ensure that each record can be uniquely
identified by a combination of one or more field found in a
table.

5
PRIMARY & FOREIGN KEYS

Foreign Key
A field in a table that matches the primary key column of another table. The
purpose of the foreign key is to ensure referential integrity of the data. In other
words, only values that are supposed to appear in the database are permitted.

6
FUNCTIONAL DEPENDENCIES
• Describes a relationship between attributes within a single table.
• An attribute is functionally dependent on another if we can use
the value of one attribute to determine the value of another.
• Example: Employee_Name is functionally dependent on
Social_Security_Number because Social_Security_Number can be
used to uniquely determine the value of Employee_Name.
The arrow symbol → is used to indicate a functional dependency.
X → Y is read X functionally determines Y

7
FUNCTIONAL DEPENDENCIES
Here are a few more examples:
- Student_ID → Student_Major
- Semester → Grade, Course_Number
- TaxRate → Car_Price
• The attributes listed on the left hand side of the → are
called determinants.
• One can read A → B as:
• A Determines B
• Given a value for A, we can determine one value for B.

8
NORMALIZATION
• Normalization is a process in which we systematically
examine relations for anomalies and, when
detected, remove those anomalies by splitting up
the relation into two new, related, relations.
In a nut shell Normalization is the process of
efficiently organizing data in a database.

9
NORMALIZATION
• Normalization is a relational database concept. If you have
created a correct entity model, then the tables created
during design will conform to the rules of normalization.
• Normalization can also be thought of as a trade-off between
data redundancy and performance. Normalizing a relation
reduces data redundancy but introduces the need for joins
when all of the data is required by an application such as a
report query.

10
NORMAL FORMS
• There are a series of guidelines for ensuring that
databases are normalized. These are divided into
•
•
•
•
•
•

1NF – First Normal Form
2NF – Second Normal Form
“Third normal form is the generally
accepted goal for a database design
3NF – Third Normal Form
that eliminated redundancy.”
4NF – Forth Normal Form
5NF – Fifth Normal Form
BCNF – Boyce & Codd Normal Form

• 4NF and 5NF are rarely seen and won't be discussed in
this chapter.

11
NORMALIZATION RULES
Normal Form Rule

Description

First Normal Form

The table contains no duplicative groups i.e. no
columns are repeated.

Second Normal Form (2NF)

The Table must be in 1NF.
An attribute must be dependent upon entity’s
entire unique identifier.

Third Normal Form (3NF)

The Table must be in 2NF.
No non-UID attribute can be dependent on
another non-UID attribute.

“Each non-primary key value MUST be dependent on the
key, the whole key, and nothing but the key.”

12
FIRST NORMAL FORM – 1NF
The table must express a set of unordered, two-dimensional table structures.
A table is considered in the first normal form if it contains no repeating groups.

• Steps to Remove Repeating Groups
1. Remove the repeating columns from the original table.
2. Create separate tables for each group of related data
3. Identify each row with a unique column or set of columns
(the primary key).
4. Create a foreign key in the new table to link back to the
original table.

13
2ND NORMAL FORM
A relation is in second normal form (2NF) if it is in 1NF and all of its non-key
attributes are dependent on all of the key.

• Another way to say this: A relation is in second normal form
if it is free from partial-key dependencies
• Relations that have a single attribute for a key are
automatically in 2NF.

14
2ND NORMAL FORM
• Steps to Remove Partial Dependencies
1. Determine which non-key columns are only partially
dependent upon the table’s primary key.
2. Remove those columns from the base table.
3. Create a second table with those non-keyed columns an
assign an appropriate primary key.
4. Create a foreign key from the original base table to the
new table, linking to the new primary key.

15
3RD NORMAL FORM
A relation is in third normal form (3NF) if it is in second normal form and
it contains no transitive dependencies.

• Steps to Remove Transitive Dependencies
1. Determine which columns are dependent on another nonkeyed column.
2. Remove those columns from the base table.
3. Create a second table with those columns and the nonkey columns that they are dependent upon.
4. Create a foreign key in the original table linking to the
primary key of the new table.

16
TOP-DOWN DESIGN VS BOTTOM UP DATABASE
SCHEMA DESIGN
• TOP DOWN
• Identifies the data sets and then defines the data
elements for each of those sets. That is entity types
are defined followed by each entity’s attributes, often
represented by ER modelling.
• BOTTOM UP
• First identifies the data elements and then groups them
together in data sets i.e. it first defines attributes and
then groups them to form entities

17
TOP-DOWN DESIGN VS BOTTOM UP DESIGN

Top Down

Entity

Attribute

Attribute

Entity

Attribute

Attribute

Bottom Up

Conceptual
Model

18
SUMMARY
1NF - The table must express a set of unordered, two
dimensional tables. The table cannot contain repeating groups.
2NF - The table must be in 1NF. Every non-key column must be
dependent on all parts of the primary key.
3NF - The table must be in 2NF. No non-key column may be
functionally dependent on another non-key column.

An entity relationship model transforms into
normalized data design.

19
REFERENCES
• Gillenson, Mark L.,2012, Fundamentals of Database
Management Systems / Mark L. Gillenson.—2nd ed., John
Wiley and sons inc
• http://holowczak.com/database-normalization/
• http://www.darkopetrovic.com/pdf/Data-Modeling-andRelational-Database-Design.pdf
• http://databases.about.com/od/specificproducts/a/normali
zation.htm

20

More Related Content

What's hot

What's hot (20)

Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
 
Normal forms
Normal formsNormal forms
Normal forms
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
 
Normalization
NormalizationNormalization
Normalization
 
Normalization in SQL | Edureka
Normalization in SQL | EdurekaNormalization in SQL | Edureka
Normalization in SQL | Edureka
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
 
Normalization
NormalizationNormalization
Normalization
 
database Normalization
database Normalizationdatabase Normalization
database Normalization
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
 
DBMS Integrity rule
DBMS Integrity ruleDBMS Integrity rule
DBMS Integrity rule
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Normalization
NormalizationNormalization
Normalization
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Normalization
NormalizationNormalization
Normalization
 
Lecture 04 normalization
Lecture 04 normalization Lecture 04 normalization
Lecture 04 normalization
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
 
File organization 1
File organization 1File organization 1
File organization 1
 

Similar to Database Management Systems 4 - Normalization

Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design Jayant Dalvi
 
Ism normalization pine valley 2012
Ism normalization pine valley 2012Ism normalization pine valley 2012
Ism normalization pine valley 2012Akshit R Shah
 
Databases - Unit 2.pdf
Databases - Unit 2.pdfDatabases - Unit 2.pdf
Databases - Unit 2.pdfCynthiaAdzornu
 
Database Engineering: Part one
Database Engineering: Part oneDatabase Engineering: Part one
Database Engineering: Part oneChristoph Becher
 
Intro To DataBase
Intro To DataBaseIntro To DataBase
Intro To DataBaseDevMix
 
Distributed database
Distributed databaseDistributed database
Distributed databaseNasIr Irshad
 
Normalization of database tables
Normalization of database tablesNormalization of database tables
Normalization of database tablesDhani Ahmad
 
Sql interview q&a
Sql interview q&aSql interview q&a
Sql interview q&aSyed Shah
 
Relational database design unit(v)
Relational database design unit(v)Relational database design unit(v)
Relational database design unit(v)PadmapriyaA6
 
Relational Theory for Budding Einsteins -- LonestarPHP 2016
Relational Theory for Budding Einsteins -- LonestarPHP 2016Relational Theory for Budding Einsteins -- LonestarPHP 2016
Relational Theory for Budding Einsteins -- LonestarPHP 2016Dave Stokes
 
Normalisation - 2nd normal form
Normalisation - 2nd normal formNormalisation - 2nd normal form
Normalisation - 2nd normal formcollege
 
relationalDatabaseModel.pptx
relationalDatabaseModel.pptxrelationalDatabaseModel.pptx
relationalDatabaseModel.pptxNirajG3
 

Similar to Database Management Systems 4 - Normalization (20)

Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
 
Ism normalization pine valley 2012
Ism normalization pine valley 2012Ism normalization pine valley 2012
Ism normalization pine valley 2012
 
DATABASE DESIGN.pptx
DATABASE DESIGN.pptxDATABASE DESIGN.pptx
DATABASE DESIGN.pptx
 
Databases - Unit 2.pdf
Databases - Unit 2.pdfDatabases - Unit 2.pdf
Databases - Unit 2.pdf
 
Database Engineering: Part one
Database Engineering: Part oneDatabase Engineering: Part one
Database Engineering: Part one
 
ER diagram
ER diagramER diagram
ER diagram
 
Intro To DataBase
Intro To DataBaseIntro To DataBase
Intro To DataBase
 
Distributed database
Distributed databaseDistributed database
Distributed database
 
Normalization of database tables
Normalization of database tablesNormalization of database tables
Normalization of database tables
 
Research gadot
Research gadotResearch gadot
Research gadot
 
Sql interview q&a
Sql interview q&aSql interview q&a
Sql interview q&a
 
demo2.ppt
demo2.pptdemo2.ppt
demo2.ppt
 
Year 11 DATA PROCESSING 1st Term
Year 11 DATA PROCESSING 1st TermYear 11 DATA PROCESSING 1st Term
Year 11 DATA PROCESSING 1st Term
 
Relational database design unit(v)
Relational database design unit(v)Relational database design unit(v)
Relational database design unit(v)
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
 
Relational Theory for Budding Einsteins -- LonestarPHP 2016
Relational Theory for Budding Einsteins -- LonestarPHP 2016Relational Theory for Budding Einsteins -- LonestarPHP 2016
Relational Theory for Budding Einsteins -- LonestarPHP 2016
 
Normalisation - 2nd normal form
Normalisation - 2nd normal formNormalisation - 2nd normal form
Normalisation - 2nd normal form
 
relationalDatabaseModel.pptx
relationalDatabaseModel.pptxrelationalDatabaseModel.pptx
relationalDatabaseModel.pptx
 
Sql
SqlSql
Sql
 
Dsa unit 1
Dsa unit 1Dsa unit 1
Dsa unit 1
 

More from Nickkisha Farrell

Database management systems 3 - Data Modelling
Database management systems 3 - Data ModellingDatabase management systems 3 - Data Modelling
Database management systems 3 - Data ModellingNickkisha Farrell
 
Database Management Systems 2
Database Management Systems 2Database Management Systems 2
Database Management Systems 2Nickkisha Farrell
 
Data security concepts chapter 2
Data security concepts chapter 2Data security concepts chapter 2
Data security concepts chapter 2Nickkisha Farrell
 
Database Management Systems 1
Database Management Systems 1Database Management Systems 1
Database Management Systems 1Nickkisha Farrell
 
About the Rotaract Organization
About the Rotaract OrganizationAbout the Rotaract Organization
About the Rotaract OrganizationNickkisha Farrell
 
Cisco Systems: A company Analysis
Cisco Systems: A company AnalysisCisco Systems: A company Analysis
Cisco Systems: A company AnalysisNickkisha Farrell
 

More from Nickkisha Farrell (9)

Database management systems 3 - Data Modelling
Database management systems 3 - Data ModellingDatabase management systems 3 - Data Modelling
Database management systems 3 - Data Modelling
 
Trade Secrets Law
Trade Secrets LawTrade Secrets Law
Trade Secrets Law
 
Database Management Systems 2
Database Management Systems 2Database Management Systems 2
Database Management Systems 2
 
Data security concepts chapter 2
Data security concepts chapter 2Data security concepts chapter 2
Data security concepts chapter 2
 
Database Management Systems 1
Database Management Systems 1Database Management Systems 1
Database Management Systems 1
 
A Teacher's Heart
A Teacher's HeartA Teacher's Heart
A Teacher's Heart
 
About the Rotaract Organization
About the Rotaract OrganizationAbout the Rotaract Organization
About the Rotaract Organization
 
Cisco Systems: A company Analysis
Cisco Systems: A company AnalysisCisco Systems: A company Analysis
Cisco Systems: A company Analysis
 
Copyright and Technology
Copyright and TechnologyCopyright and Technology
Copyright and Technology
 

Recently uploaded

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Recently uploaded (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Database Management Systems 4 - Normalization

  • 1. Database Management Systems Data Modelling Part 2 Normalization By Nickkisha Farrell, BSc IT, Dip Ed February 2014
  • 2. IN THIS PRESENTATION Entity and Referential Integrity Physical Database Design: tables, primary keys, foreign keys Normalization - 1st , 2nd , 3rd Normal Forms Top-down versus Bottom-up Design 2
  • 3. TABLES / RELATIONS When creating a table also called a relation: • Each attribute value must be a single value only. • All values for a given attribute must be of the same data type. • Each attribute (column) name must be unique. • The order of attributes (columns) is insignificant • No two tuples (rows) in a relation should be identical. • The order of the tuples (rows) is insignificant. 3
  • 4. ENTITY AND REFERENTIAL INTEGRITY • An Entity typically corresponds to a relation. • Thus an entity’s attributes become attributes of the relation. • These attributes are represented by columns in a relation 4
  • 5. KEYS • Keys play a very important role in relational databases. They are used to establish and identify relationships between tables. They are also ensure that each record can be uniquely identified by a combination of one or more field found in a table. 5
  • 6. PRIMARY & FOREIGN KEYS Foreign Key A field in a table that matches the primary key column of another table. The purpose of the foreign key is to ensure referential integrity of the data. In other words, only values that are supposed to appear in the database are permitted. 6
  • 7. FUNCTIONAL DEPENDENCIES • Describes a relationship between attributes within a single table. • An attribute is functionally dependent on another if we can use the value of one attribute to determine the value of another. • Example: Employee_Name is functionally dependent on Social_Security_Number because Social_Security_Number can be used to uniquely determine the value of Employee_Name. The arrow symbol → is used to indicate a functional dependency. X → Y is read X functionally determines Y 7
  • 8. FUNCTIONAL DEPENDENCIES Here are a few more examples: - Student_ID → Student_Major - Semester → Grade, Course_Number - TaxRate → Car_Price • The attributes listed on the left hand side of the → are called determinants. • One can read A → B as: • A Determines B • Given a value for A, we can determine one value for B. 8
  • 9. NORMALIZATION • Normalization is a process in which we systematically examine relations for anomalies and, when detected, remove those anomalies by splitting up the relation into two new, related, relations. In a nut shell Normalization is the process of efficiently organizing data in a database. 9
  • 10. NORMALIZATION • Normalization is a relational database concept. If you have created a correct entity model, then the tables created during design will conform to the rules of normalization. • Normalization can also be thought of as a trade-off between data redundancy and performance. Normalizing a relation reduces data redundancy but introduces the need for joins when all of the data is required by an application such as a report query. 10
  • 11. NORMAL FORMS • There are a series of guidelines for ensuring that databases are normalized. These are divided into • • • • • • 1NF – First Normal Form 2NF – Second Normal Form “Third normal form is the generally accepted goal for a database design 3NF – Third Normal Form that eliminated redundancy.” 4NF – Forth Normal Form 5NF – Fifth Normal Form BCNF – Boyce & Codd Normal Form • 4NF and 5NF are rarely seen and won't be discussed in this chapter. 11
  • 12. NORMALIZATION RULES Normal Form Rule Description First Normal Form The table contains no duplicative groups i.e. no columns are repeated. Second Normal Form (2NF) The Table must be in 1NF. An attribute must be dependent upon entity’s entire unique identifier. Third Normal Form (3NF) The Table must be in 2NF. No non-UID attribute can be dependent on another non-UID attribute. “Each non-primary key value MUST be dependent on the key, the whole key, and nothing but the key.” 12
  • 13. FIRST NORMAL FORM – 1NF The table must express a set of unordered, two-dimensional table structures. A table is considered in the first normal form if it contains no repeating groups. • Steps to Remove Repeating Groups 1. Remove the repeating columns from the original table. 2. Create separate tables for each group of related data 3. Identify each row with a unique column or set of columns (the primary key). 4. Create a foreign key in the new table to link back to the original table. 13
  • 14. 2ND NORMAL FORM A relation is in second normal form (2NF) if it is in 1NF and all of its non-key attributes are dependent on all of the key. • Another way to say this: A relation is in second normal form if it is free from partial-key dependencies • Relations that have a single attribute for a key are automatically in 2NF. 14
  • 15. 2ND NORMAL FORM • Steps to Remove Partial Dependencies 1. Determine which non-key columns are only partially dependent upon the table’s primary key. 2. Remove those columns from the base table. 3. Create a second table with those non-keyed columns an assign an appropriate primary key. 4. Create a foreign key from the original base table to the new table, linking to the new primary key. 15
  • 16. 3RD NORMAL FORM A relation is in third normal form (3NF) if it is in second normal form and it contains no transitive dependencies. • Steps to Remove Transitive Dependencies 1. Determine which columns are dependent on another nonkeyed column. 2. Remove those columns from the base table. 3. Create a second table with those columns and the nonkey columns that they are dependent upon. 4. Create a foreign key in the original table linking to the primary key of the new table. 16
  • 17. TOP-DOWN DESIGN VS BOTTOM UP DATABASE SCHEMA DESIGN • TOP DOWN • Identifies the data sets and then defines the data elements for each of those sets. That is entity types are defined followed by each entity’s attributes, often represented by ER modelling. • BOTTOM UP • First identifies the data elements and then groups them together in data sets i.e. it first defines attributes and then groups them to form entities 17
  • 18. TOP-DOWN DESIGN VS BOTTOM UP DESIGN Top Down Entity Attribute Attribute Entity Attribute Attribute Bottom Up Conceptual Model 18
  • 19. SUMMARY 1NF - The table must express a set of unordered, two dimensional tables. The table cannot contain repeating groups. 2NF - The table must be in 1NF. Every non-key column must be dependent on all parts of the primary key. 3NF - The table must be in 2NF. No non-key column may be functionally dependent on another non-key column. An entity relationship model transforms into normalized data design. 19
  • 20. REFERENCES • Gillenson, Mark L.,2012, Fundamentals of Database Management Systems / Mark L. Gillenson.—2nd ed., John Wiley and sons inc • http://holowczak.com/database-normalization/ • http://www.darkopetrovic.com/pdf/Data-Modeling-andRelational-Database-Design.pdf • http://databases.about.com/od/specificproducts/a/normali zation.htm 20