Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004...

12

Transcript of Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004...

Page 1: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Page 2: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Chapter 4

Functional Dependencies and Normalization for Relational

Databases

Copyright © 2004 Pearson Education, Inc.

Page 3: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-3

Achieving the BCNF by Decomposition (2)

Data normalization is a process in which data attributes within a data model are organized to increase the cohesion of entity types.

In other words, the goal of data normalization is to reduce and even eliminate data redundancy, an important consideration for application developers because it is incredibly difficult to stores objects in a relational database that maintains the same information in several places.

Page 4: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition

Table 1 summarizes the three most common forms of normalization First normal form (1NF), Second normal form (2NF), and Third normal form (3NF) describing how to put entity types into a

series of increasing levels of normalization.

Chapter 10-4

Level RuleFirst normal form (1NF) An entity type is in 1NF when it contains no repeating groups

of data.Second normal form (2NF) An entity type is in 2NF when it is in 1NF and when all of its

non-key attributes are fully dependent on its primary key. 

Third normal form (3NF) An entity type is in 3NF when it is in 2NF and when all of its attributes are directly dependent on the primary key.

Page 5: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition

First Normal Form (1NF)

Let’s consider an example. n entity type is in first normal form (1NF) when it contains no repeating groups of data.  For example, in Figure 1 you see that there are several repeating attributes in the data Order0NF table

Chapter 10-5

Page 6: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-6

Page 7: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition

First normal form (1NF)

Chapter 10-7

Page 8: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition

Second Normal Form (2NF)

Chapter 10-8

Page 9: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition

. Third Normal Form (3NF)

Chapter 10-9

. Third Normal Form (3NF)

Page 10: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition

Beyond 3NF

Chapter 10-10

Page 11: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition

Why Data Normalization?

 The advantage of having a highly normalized data schema is that information is stored in one place and one place only, reducing the possibility of inconsistent data.  

Chapter 10-11

Page 12: Chapter 4 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Ramez Elmasri and Shamkant NavatheElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition

Furthermore, highly-normalized data schemas in general are closer conceptually to object-oriented schemas because the object-oriented goals.  

This generally makes it easier to map your objects to your data schema. 

Chapter 10-12