SlideShare a Scribd company logo
Prepared by Feven T. Chap 5 1
Chapter Four
Functional Dependency and Normalization
content
Purpose of Normalization
Functional Dependency
Normalization
Prepared by Feven T. Chap 5
Purpose of Normalization
 Normalization
Is technique for producing set of suitable relations that support
data of enterprise.
Is the process of decomposing unsatisfactory "bad" relations
by breaking up their attributes into smaller relations.
Why do we need to normalize?
 To avoid redundancy (less storage space
needed, and data is consistent)
To avoid update/delete anomalies.
Organize data efficiently
2
Functional Dependencies
A functional dependency occurs when the value of one (a
set of) attribute(s) determines the value of a second (set of)
attribute(s) in the same table.
StudentID  StudentName
StudentID  (DormName, DormRoom, Fee)
 The attribute on the left side of the functional dependency
is called the determinant.
 Function dependencies are not equations!
Prepared by Feven T . Chap 5 3
Prepared by Feven T. Chap 5
Characteristics of Functional Dependencies
 Diagrammatic representation
 Determinant
 Attribute or group of attributes on left-hand side of
arrow.
4
Prepared by Feven T. Chap 5 5
 Composite determinant: A determinant of a
functional dependency that consists of more
than one attribute
(StudentName, ClassName)  (Grade)
Functional Dependency Rules
 If A  (B, C), then A  B and A C
 If (A,B)  C, then neither A nor B determines C
by itself.
Prepared by Feven T. Chap 5
An Example Functional Dependency
6
Prepared by Feven T. Chap 5
Example Functional Dependency that holds
for all Time
EmpNum EmpEmail EmpFname EmpLname
123 jdoe@abc.com John Doe
456 psmith@abc.com Peter Smith
555 alee1@abc.com Alan Lee
633 pdoe@abc.com Peter Doe
787 alee2@abc.com Alan Lee
7
If EmpNum is the PK then the FDs:
EmpNum  EmpEmail
EmpNum  EmpFname
EmpNum  EmpLname
must exist.
Prepared by Feven T. Chap 5
Functional Dependencies
8
EmpNum  EmpEmail
EmpNum  EmpFname
EmpNum  EmpLname
EmpNum
EmpEmail
EmpFname
EmpLname
EmpNum EmpEmail EmpFname EmpLname
3 different ways you
might see FDs
depicted
Transitive dependency
Prepared by Feven T. Chap 5 9
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.
Transitive dependency
Prepared by Feven T. Chap 5 10
EmpNum EmpEmail DeptNum DeptNname
EmpNum EmpEmail DeptNum DeptNname
DeptName is transitively dependent on EmpNum via DeptNum
EmpNum  DeptName
EmpNum  DeptNum
DeptNum  DeptName
Partial dependency
Prepared by Feven T. Chap 5 11
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.
InvNum LineNum Qty InvDate
Candidate keys: {InvNum, LineNum} InvDate is partially
dependent on {InvNum, LineNum} as InvNum is a
determinant of InvDate and InvNum is part of a candidate
key
Prepared by Feven T. Chap 5 12
Multivaled Dependencies
A multivaled dependency occurs when a determinant determines
a particular set of values:
Employee  Degree
Employee  Sibling
PartKit  Part
The determinant of a multivaled dependency can never be a
primary key
Prepared by Feven T. Chap 5
Characteristics of Functional Dependencies
Determinants should have minimal number of
attributes necessary to maintain functional
dependency with attribute(s) on right hand-side
Called full functional dependency.
Full functional dependency indicates that if A and
B are attributes of relation, B is fully functionally
dependent on A, if B is functionally dependent on A,
but not on any proper subset of A.
13
Prepared by Feven T. Chap 5
Example Full Functional Dependency
 Exists in the Staff relation
staffNo, sName → branchNo
 Each value of (staffNo, sName) is associated with single
value of branchNo
 branchNo also functionally dependent on subset of (staffNo,
sName)
 (staffNo, sName) - partial dependency
14
Prepared by Feven T. Chap 5
Con’t....
 Main characteristics of functional dependencies used in
normalization:
 One-to-one relationship between attribute(s) on left-hand
side (determinant) and right-hand side of functional
dependency
 Determinant has minimal number of attributes necessary to
maintain dependency with attribute(s) on right hand-side
15
Prepared by Feven T. Chap 5 16
Normalization
 Normalization: The process of decomposing
unsatisfactory "bad" relations by breaking up
their attributes into smaller relations.
 Normal form: Condition using keys and FDs of a
relation to certify whether a relation schema is
in a particular normal form
Prepared by Feven T. Chap 5 17
Normal Forms: Review
Unnormalized – There are multivalued
attributes or repeating groups
1 NF – No multivalued attributes or repeating
groups.
2 NF – 1 NF plus no partial dependencies
3 NF – 2 NF plus no transitive dependencies
Prepared by Feven T. Chap 5 18
First Normal Form (1NF)
All attributes are atomic(no repeating groups).
Disallows composite attributes, multivalued
attributes, and nested relations; attributes whose values
for an individual tuple are non-atomic
Values must be simple.
 Remove horizontal redundancies
 No two columns hold the same information
 No single column holds more than a single item
Prepared by Feven T. Chap 5 19
Con’t…
 Each row must be unique
 Use a primary key
 Benefits
 Easier to query/sort the data
 More scalable
 Each row can be identified for updating
First Normal Form
Prepared by Feven T. Chap 5 20
The following in not in 1NF
EmpNum EmpPhone EmpDegrees
123 233-9876
333 233-1231 BA, BSc, PhD
679 233-1231 BSc, MSc
EmpDegrees is a multi-valued field:
employee 679 has two degrees: BSc and MSc
employee 333 has three degrees: BA, BSc, PhD
To obtain 1NF relations without loss of information, replace the
above with two relations
First Normal Form
Prepared by Feven T. Chap 5 21
EmpNum EmpDegree
333 BA
333 BSc
333 PhD
679 BSc
MSc
679
EmpNum EmpPhone
123 233-9876
333 233-1231
679 233-1231
An outer join between Employee and EmployeeDegree will produce
the information we saw before
Employee
EmployeeDegree
Prepared by Feven T. Chap 5 22
Second Normal Form (2NF)
Table must be in First Normal Form
Remove vertical redundancy
The same value should not repeat
across rows
Composite keys
• All columns in a row must refer to
BOTH parts of the key
Benefits
• Increased storage efficiency
• Less data repetition
All non-key attributes are fully dependent on the
PK (“no partial dependencies”)
 A relation in 2NF will not have any partial
dependencies.
Prepared by Feven T. Chap 5 23
Second Normal Form (2NF)
This table has a composite primary key [Customer ID, Store ID].
The non-key attribute is [Purchase Location]. In this case,
[Purchase Location] only depends on [Store ID], which is only
part of the primary key. Therefore, this table does not satisfy
second normal form.
Prepared by Feven T. Chap 5 24
Second Normal Form (2NF)
To bring this table to second normal form, we break the table into two
tables, and now we have the following:
What we have done is to remove the partial functional dependency that we
initially had. Now, in the table [TABLE_STORE], the column [Purchase
Location] is fully dependent on the primary key of that table, which is [Store
ID].
Prepared by Feven T. Chap 5 25
Third Normal Form (3NF)
• A relation in 3NF will not have any transitive dependencies of
non-key attribute on a candidate key through another non-key
attribute.
 Table must be in Second Normal Form
 If your table is 2NF, there is a good chance it is 3NF
 All columns must relate directly to the primary key
 Benefits
 No extraneous data
Third Normal Form
Prepared by Feven T. Chap 5 26
EmpNum EmpName DeptNum DeptName
EmpName, DeptNum, and DeptName are non-key attributes.
DeptNum determines DeptName, a non-key attribute, and DeptNum is
not a candidate key.
Consider this Employee relation
Is the relation in 3NF? … no
Is the relation in 2NF? … yes
Candidate
keys are? …
Third Normal Form
Prepared by Feven T. Chap 5 27
EmpNum EmpName DeptNum DeptName
We correct the situation by decomposing the original relation into two
3NF relations. Note the decomposition is lossless.
EmpNum EmpName DeptNum DeptName
DeptNum
Verify these two relations are in 3NF.
Prepared by Feven T. Chap 5 28
Reading Assignment
Boyce Code Normal Form

More Related Content

PDF
Penormalan/Normalization
PPTX
Chapter Four Logical Database Design (Normalization).pptx
PPTX
Learn more about database normalization concepts
PDF
Chapter 2 Relational Data Model-part 3
PPTX
Normalization in Relational database management systems
PPTX
Normalization in rdbms types and examples
PPT
Chapter six - Normalization.ppt fundamental of db
PDF
chapter 4-Functional Dependency and Normilization.pdf
Penormalan/Normalization
Chapter Four Logical Database Design (Normalization).pptx
Learn more about database normalization concepts
Chapter 2 Relational Data Model-part 3
Normalization in Relational database management systems
Normalization in rdbms types and examples
Chapter six - Normalization.ppt fundamental of db
chapter 4-Functional Dependency and Normilization.pdf

Similar to Chapter 4.pptxdatabase presentation foe fund (20)

PPTX
DBMS_Module 3_Functional Dependencies and Normalization.pptx
PDF
Database management system session 5
PPT
Chuẩn hóa CSDL
PPT
Ch 6 Logical D B Design
PPT
Normalization of database_tables_chapter_4
PPTX
DBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdk
PPT
Kul 2
PPTX
Normalization
PPT
Normlaization
PDF
24042020_normalization 1.pdf
PPTX
Normalization
PPT
Normalization(15.09.2010)
PDF
L9 design2
PPTX
normalization ppt.pptx
PDF
Database Systems - Normalization of Relations(Chapter 4/3)
PDF
Assignment#11
PPT
Top schools in india
PPT
Normal forms.ppt
PPTX
Normalization
DBMS_Module 3_Functional Dependencies and Normalization.pptx
Database management system session 5
Chuẩn hóa CSDL
Ch 6 Logical D B Design
Normalization of database_tables_chapter_4
DBMS_UNIT_IV.pptxbdndjdkdjdndjkdkdkdkdkdkdk
Kul 2
Normalization
Normlaization
24042020_normalization 1.pdf
Normalization
Normalization(15.09.2010)
L9 design2
normalization ppt.pptx
Database Systems - Normalization of Relations(Chapter 4/3)
Assignment#11
Top schools in india
Normal forms.ppt
Normalization
Ad

Recently uploaded (20)

PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPTX
Database Infoormation System (DBIS).pptx
PPT
Predictive modeling basics in data cleaning process
PPT
ISS -ESG Data flows What is ESG and HowHow
PDF
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305
PPTX
IMPACT OF LANDSLIDE.....................
PPTX
retention in jsjsksksksnbsndjddjdnFPD.pptx
PPTX
SAP 2 completion done . PRESENTATION.pptx
PDF
Transcultural that can help you someday.
PDF
How to run a consulting project- client discovery
PDF
Business Analytics and business intelligence.pdf
PPTX
Market Analysis -202507- Wind-Solar+Hybrid+Street+Lights+for+the+North+Amer...
PDF
Optimise Shopper Experiences with a Strong Data Estate.pdf
PDF
[EN] Industrial Machine Downtime Prediction
PPTX
A Complete Guide to Streamlining Business Processes
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
Topic 5 Presentation 5 Lesson 5 Corporate Fin
PDF
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPTX
Pilar Kemerdekaan dan Identi Bangsa.pptx
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Database Infoormation System (DBIS).pptx
Predictive modeling basics in data cleaning process
ISS -ESG Data flows What is ESG and HowHow
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305
IMPACT OF LANDSLIDE.....................
retention in jsjsksksksnbsndjddjdnFPD.pptx
SAP 2 completion done . PRESENTATION.pptx
Transcultural that can help you someday.
How to run a consulting project- client discovery
Business Analytics and business intelligence.pdf
Market Analysis -202507- Wind-Solar+Hybrid+Street+Lights+for+the+North+Amer...
Optimise Shopper Experiences with a Strong Data Estate.pdf
[EN] Industrial Machine Downtime Prediction
A Complete Guide to Streamlining Business Processes
Acceptance and paychological effects of mandatory extra coach I classes.pptx
Topic 5 Presentation 5 Lesson 5 Corporate Fin
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Pilar Kemerdekaan dan Identi Bangsa.pptx
Ad

Chapter 4.pptxdatabase presentation foe fund

  • 1. Prepared by Feven T. Chap 5 1 Chapter Four Functional Dependency and Normalization content Purpose of Normalization Functional Dependency Normalization
  • 2. Prepared by Feven T. Chap 5 Purpose of Normalization  Normalization Is technique for producing set of suitable relations that support data of enterprise. Is the process of decomposing unsatisfactory "bad" relations by breaking up their attributes into smaller relations. Why do we need to normalize?  To avoid redundancy (less storage space needed, and data is consistent) To avoid update/delete anomalies. Organize data efficiently 2
  • 3. Functional Dependencies A functional dependency occurs when the value of one (a set of) attribute(s) determines the value of a second (set of) attribute(s) in the same table. StudentID  StudentName StudentID  (DormName, DormRoom, Fee)  The attribute on the left side of the functional dependency is called the determinant.  Function dependencies are not equations! Prepared by Feven T . Chap 5 3
  • 4. Prepared by Feven T. Chap 5 Characteristics of Functional Dependencies  Diagrammatic representation  Determinant  Attribute or group of attributes on left-hand side of arrow. 4
  • 5. Prepared by Feven T. Chap 5 5  Composite determinant: A determinant of a functional dependency that consists of more than one attribute (StudentName, ClassName)  (Grade) Functional Dependency Rules  If A  (B, C), then A  B and A C  If (A,B)  C, then neither A nor B determines C by itself.
  • 6. Prepared by Feven T. Chap 5 An Example Functional Dependency 6
  • 7. Prepared by Feven T. Chap 5 Example Functional Dependency that holds for all Time EmpNum EmpEmail EmpFname EmpLname 123 jdoe@abc.com John Doe 456 psmith@abc.com Peter Smith 555 alee1@abc.com Alan Lee 633 pdoe@abc.com Peter Doe 787 alee2@abc.com Alan Lee 7 If EmpNum is the PK then the FDs: EmpNum  EmpEmail EmpNum  EmpFname EmpNum  EmpLname must exist.
  • 8. Prepared by Feven T. Chap 5 Functional Dependencies 8 EmpNum  EmpEmail EmpNum  EmpFname EmpNum  EmpLname EmpNum EmpEmail EmpFname EmpLname EmpNum EmpEmail EmpFname EmpLname 3 different ways you might see FDs depicted
  • 9. Transitive dependency Prepared by Feven T. Chap 5 9 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.
  • 10. Transitive dependency Prepared by Feven T. Chap 5 10 EmpNum EmpEmail DeptNum DeptNname EmpNum EmpEmail DeptNum DeptNname DeptName is transitively dependent on EmpNum via DeptNum EmpNum  DeptName EmpNum  DeptNum DeptNum  DeptName
  • 11. Partial dependency Prepared by Feven T. Chap 5 11 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. InvNum LineNum Qty InvDate Candidate keys: {InvNum, LineNum} InvDate is partially dependent on {InvNum, LineNum} as InvNum is a determinant of InvDate and InvNum is part of a candidate key
  • 12. Prepared by Feven T. Chap 5 12 Multivaled Dependencies A multivaled dependency occurs when a determinant determines a particular set of values: Employee  Degree Employee  Sibling PartKit  Part The determinant of a multivaled dependency can never be a primary key
  • 13. Prepared by Feven T. Chap 5 Characteristics of Functional Dependencies Determinants should have minimal number of attributes necessary to maintain functional dependency with attribute(s) on right hand-side Called full functional dependency. Full functional dependency indicates that if A and B are attributes of relation, B is fully functionally dependent on A, if B is functionally dependent on A, but not on any proper subset of A. 13
  • 14. Prepared by Feven T. Chap 5 Example Full Functional Dependency  Exists in the Staff relation staffNo, sName → branchNo  Each value of (staffNo, sName) is associated with single value of branchNo  branchNo also functionally dependent on subset of (staffNo, sName)  (staffNo, sName) - partial dependency 14
  • 15. Prepared by Feven T. Chap 5 Con’t....  Main characteristics of functional dependencies used in normalization:  One-to-one relationship between attribute(s) on left-hand side (determinant) and right-hand side of functional dependency  Determinant has minimal number of attributes necessary to maintain dependency with attribute(s) on right hand-side 15
  • 16. Prepared by Feven T. Chap 5 16 Normalization  Normalization: The process of decomposing unsatisfactory "bad" relations by breaking up their attributes into smaller relations.  Normal form: Condition using keys and FDs of a relation to certify whether a relation schema is in a particular normal form
  • 17. Prepared by Feven T. Chap 5 17 Normal Forms: Review Unnormalized – There are multivalued attributes or repeating groups 1 NF – No multivalued attributes or repeating groups. 2 NF – 1 NF plus no partial dependencies 3 NF – 2 NF plus no transitive dependencies
  • 18. Prepared by Feven T. Chap 5 18 First Normal Form (1NF) All attributes are atomic(no repeating groups). Disallows composite attributes, multivalued attributes, and nested relations; attributes whose values for an individual tuple are non-atomic Values must be simple.  Remove horizontal redundancies  No two columns hold the same information  No single column holds more than a single item
  • 19. Prepared by Feven T. Chap 5 19 Con’t…  Each row must be unique  Use a primary key  Benefits  Easier to query/sort the data  More scalable  Each row can be identified for updating
  • 20. First Normal Form Prepared by Feven T. Chap 5 20 The following in not in 1NF EmpNum EmpPhone EmpDegrees 123 233-9876 333 233-1231 BA, BSc, PhD 679 233-1231 BSc, MSc EmpDegrees is a multi-valued field: employee 679 has two degrees: BSc and MSc employee 333 has three degrees: BA, BSc, PhD To obtain 1NF relations without loss of information, replace the above with two relations
  • 21. First Normal Form Prepared by Feven T. Chap 5 21 EmpNum EmpDegree 333 BA 333 BSc 333 PhD 679 BSc MSc 679 EmpNum EmpPhone 123 233-9876 333 233-1231 679 233-1231 An outer join between Employee and EmployeeDegree will produce the information we saw before Employee EmployeeDegree
  • 22. Prepared by Feven T. Chap 5 22 Second Normal Form (2NF) Table must be in First Normal Form Remove vertical redundancy The same value should not repeat across rows Composite keys • All columns in a row must refer to BOTH parts of the key Benefits • Increased storage efficiency • Less data repetition All non-key attributes are fully dependent on the PK (“no partial dependencies”)  A relation in 2NF will not have any partial dependencies.
  • 23. Prepared by Feven T. Chap 5 23 Second Normal Form (2NF) This table has a composite primary key [Customer ID, Store ID]. The non-key attribute is [Purchase Location]. In this case, [Purchase Location] only depends on [Store ID], which is only part of the primary key. Therefore, this table does not satisfy second normal form.
  • 24. Prepared by Feven T. Chap 5 24 Second Normal Form (2NF) To bring this table to second normal form, we break the table into two tables, and now we have the following: What we have done is to remove the partial functional dependency that we initially had. Now, in the table [TABLE_STORE], the column [Purchase Location] is fully dependent on the primary key of that table, which is [Store ID].
  • 25. Prepared by Feven T. Chap 5 25 Third Normal Form (3NF) • A relation in 3NF will not have any transitive dependencies of non-key attribute on a candidate key through another non-key attribute.  Table must be in Second Normal Form  If your table is 2NF, there is a good chance it is 3NF  All columns must relate directly to the primary key  Benefits  No extraneous data
  • 26. Third Normal Form Prepared by Feven T. Chap 5 26 EmpNum EmpName DeptNum DeptName EmpName, DeptNum, and DeptName are non-key attributes. DeptNum determines DeptName, a non-key attribute, and DeptNum is not a candidate key. Consider this Employee relation Is the relation in 3NF? … no Is the relation in 2NF? … yes Candidate keys are? …
  • 27. Third Normal Form Prepared by Feven T. Chap 5 27 EmpNum EmpName DeptNum DeptName We correct the situation by decomposing the original relation into two 3NF relations. Note the decomposition is lossless. EmpNum EmpName DeptNum DeptName DeptNum Verify these two relations are in 3NF.
  • 28. Prepared by Feven T. Chap 5 28 Reading Assignment Boyce Code Normal Form