Chapter 14 Normalization – Part I Pearson Education © 2009.

Slides:



Advertisements
Similar presentations
© Pearson Education Limited, Chapter 8 Normalization Transparencies.
Advertisements

The Relational Model System Development Life Cycle Normalisation
1 Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Normalization I.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Chapter 5 Normalization Transparencies © Pearson Education Limited 1995, 2005.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
LOGICAL DATABASE DESIGN
CSC271 Database Systems Lecture # 6. Summary: Previous Lecture  Relational model terminology  Mathematical relations  Database relations  Properties.
Normalization. Introduction Badly structured tables, that contains redundant data, may suffer from Update anomalies : Insertions Deletions Modification.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Lecture 12 Inst: Haya Sammaneh
Chapter 6 Normalization 正規化. 6-2 In This Chapter You Will Learn:  更動異常  How tables that contain redundant data can suffer from update anomalies ( 更動異常.
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
Chapter 13 Normalization Transparencies. 2 Last Class u Access Lab.
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
1 Pertemuan 23 Normalisasi Matakuliah: >/ > Tahun: > Versi: >
Normalization Transparencies
CSC271 Database Systems Lecture # 29. Summary: Previous Lecture  The normalization process  1NF, 2NF, 3NF  Inference rules for FDs  BCNF.
Functional Dependencies and Normalization for Relational Databases.
Chapter 13 Normalization Transparencies. 2 Chapter 13 - Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification.
COMP1212 COMP1212 Anomalies and Dependencies Dr. Mabruk Ali.
Chapter 13 Normalization © Pearson Education Limited 1995, 2005.
Lecture 5 Normalization. Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems.
Chapter 13 Normalization Transparencies Last Updated: 08 th May 2011 By M. Arief
Chapter 10 Normalization Pearson Education © 2009.
1 Functional Dependencies and Normalization Chapter 15.
Functional Dependency, Normalization
Normalization Transparencies 1. ©Pearson Education 2009 Objectives How the technique of normalization is used in database design. How tables that contain.
Lecture Nine: Normalization
© Pearson Education Limited, Normalization Bayu Adhi Tama, M.T.I. Faculty of Computer Science University of Sriwijaya.
9/23/2012ISC329 Isabelle Bichindaritz1 Normalization.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Normalization. Overview Earliest  formalized database design technique and at one time was the starting point for logical database design. Today  is.
ITD1312 Database Principles Chapter 4C: Normalization.
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
NORMALIZATION.
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
Chapter 9 Normalization Chapter 14 & 15 in Textbook.
Chapter 8 Relational Database Design Topic 1: Normalization Chuan Li 1 © Pearson Education Limited 1995, 2005.
10/3/2017.
Normalization.
Methodology Logical Database Design for the Relational Model
Functional Dependency and Normalization
Normalization Karolina muszyńska
Normalization DBMS.
Normalization Dongsheng Lu Feb 21, 2003.
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
Chapter 4 Relational Databases
Chapter 14 Normalization
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Normalization.
Database Normalization
Chapter 14 & Chapter 15 Normalization Pearson Education © 2009.
Normalization.
Normalization Dongsheng Lu Feb 21, 2003.
Normalization Dale-Marie Wilson, Ph.D..
Database solutions Chosen aspects of the relational model Marzena Nowakowska Faculty of Management and Computer Modelling Kielce University of Technology.
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Chapter 14 Normalization.
Minggu 9, Pertemuan 18 Normalization
Normalization cs3431.
Chapter 14 Normalization.
國立臺北科技大學 課程:資料庫系統 2015 fall Chapter 14 Normalization.
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
Presentation transcript:

Chapter 14 Normalization – Part I Pearson Education © 2009

Chapter 14 - Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems associated with redundant data in base relations. The concept of functional dependency, which describes the relationship between attributes. The characteristics of functional dependencies used in normalization. How to identify functional dependencies for a given relation. How functional dependencies identify the primary key for a relation. Pearson Education © 2009

Normalization And Database Design Normalization: is a technique for producing a set of suitable relations that support the data requirements of an enterprise. Characteristics of a suitable set of relations include: the minimal number of attributes necessary to support the data requirements of the enterprise; attributes with a close logical relationship are found in the same relation; minimal redundancy with each attribute represented only once with the important exception of attributes that form all or part of foreign keys. Pearson Education © 2009

Normalization And Database Design Normalization can support DB design as: A bottom-up standalone database design technique , Or a validation technique to check the structure of the relations which have been created using database design technique such as (ER modeling).

How Normalization Supports Database Design Pearson Education © 2009

Purpose of Normalization The benefits of using a database that has a suitable set of relations is that the database will be: easier for the user to access and maintain the data; take up minimal storage space on the computer. Pearson Education © 2009

Data Redundancy Data redundancy is a condition created within a database or data storage technology in which the same piece of data is held in two separate places. This can mean two different fields within a single database, or two different spots in multiple software environments or platforms.

Data Redundancy and Update Anomalies Major aim of relational database design is to group attributes into relations to minimize data redundancy. If this aim is achieved, the potential benefits for implemented database include: Updates to the data stored in the database are achieved with a minimal number of operations thus reducing the opportunities for data inconsistencies occurring in the database. Reduction in the file storage space required by the base relations thus minimizing costs. Pearson Education © 2009

Data Redundancy and Update Anomalies Example : Problems associated with data redundancy are illustrated by comparing the Staff and Branch relations with the StaffBranch relation. Pearson Education © 2009

Data Redundancy and Update Anomalies (branchNo) is repeated in the Staff relation, to represent where each member of staff is located Redundant data Pearson Education © 2009

Data Redundancy and Update Anomalies Relations that contain redundant information may potentially suffer from update anomalies. Types of update anomalies include Insertion Deletion Modification Pearson Education © 2009

Relation Decomposition Normalization process involve decomposing a relation. Decomposition require to be reversible. Functional dependencies guarantee decomposition to be reversible. While normalization, two important properties associated with decomposition: Lossless-join property enables us to find any instance of the original relation from corresponding instances in the smaller relations. Dependency preservation property enables us to enforce a constraint on the original relation by enforcing some constraint on each of the smaller relations. Pearson Education © 2009

Functional Dependencies Important concept associated with normalization. Describes the relationship between attributes in a relation. If A and B are attributes of relation R, B is functionally dependent on A, denoted A  B, if each value of A is associated with exactly one value of B, B may have several values of A. When two tuples have the same value of A, they also have the same value B Determinant Dependent An alternative way to describe the relation ship between attribute A an B is to say that “ A functionally determines B” A B is functionally dependent on A B Pearson Education © 2009

An Example Functional Dependency 1:1 or M:1 relationship between attributes in a relation 1:M relationship between attributes in a relation Pearson Education © 2009

Example Functional Dependency that holds for all Time Consider the values shown in staffNo and sName attributes of the Staff relation. Based on sample data, the following functional dependencies appear to hold. staffNo → sName sName → staffNo However, the only functional dependency that remains true for all possible values for the staffNo and sName attributes of the Staff relation is: Pearson Education © 2009

Characteristics of Functional Dependencies Full functional dependency indicates that if A and B are attributes of a relation, B is fully functionally dependent on A, if B is functionally dependent on A, but not on any proper subset of A. A  B is a full functional dependency if removal of any attribute from A results in the dependency no longer existing. Pearson Education © 2009

Example Full Functional Dependency In the Staff relation staffNo, sName → branchNo staffNo→ branchNo True - each value of (staffNo, sName) is associated with a single value of branchNo. However, branchNo is also functionally dependent on a subset of (staffNo, sName), namely staffNo. Example above is a partial dependency. Partial dependency Fully dependency Pearson Education © 2009

Transitive Dependencies Transitive dependency describes a condition where A, B, and C are attributes of a relation such that if A → B B → C then C is transitively dependent on A via B A → C provided that A is not functionally dependent on B or C. B → A, and C → A doesn't exist Important to recognize a transitive dependency because its existence in a relation can potentially cause update anomalies. Pearson Education © 2009

Example Transitive Dependency Consider functional dependencies in the StaffBranch relation. staffNo → sName, position, salary, branchNo, bAddress branchNo → bAddress Transitive dependency, staffNo → bAddress exists via branchNo (staffNo functionally determines the bAddress via branchNo ). And, neither branchNo nor bAddress functionally determines staffNo. branchNo → staffNo , and bAddress → staffNo doesn't exist Pearson Education © 2009

Summary Characteristics of Functional Dependencies Main characteristics of functional dependencies used in normalization: There is a one-to-one/ many-to-one relationship between the determinant and dependent. Holds for all time. There must be a full functional dependency between determinant and dependent. Pearson Education © 2009

Identifying Functional Dependencies There are two approach to Identifying all functional dependencies : 1. Identifying all functional dependencies between a set of attributes is quite simple if the meaning of each attribute and the relationships between the attributes are well understood. This information should be provided by the enterprise (discussions with users and/or documentation) The missing information Ex: documentation is incomplete (database designer use their common sense and/or experience). 2. It may possible to identify functional dependencies if sample data is available that is true representation of all possible data. Pearson Education © 2009

Example - Identifying a set of functional dependencies for the StaffBranch relation

Example - Identifying a set of functional dependencies for the StaffBranch relation Identifing the functional dependencies for the StaffBranch relation as: staffNo → sName, position, salary, branchNo, bAddress branchNo → bAddress bAddress → branchNo branchNo, position → salary bAddress, position → salary Hint : Assume that position held and branch determine a member of staff’s salary. Pearson Education © 2009

Example - Using sample data to identify functional dependencies. Consider the data for attributes denoted A, B, C, D, and E in the Sample relation (see Slide 25). Important to establish that sample data values shown in relation are representative of all possible values that can be held by attributes A, B, C, D, and E. Assume true despite the relatively small amount of data shown in this relation. Pearson Education © 2009

Example - Using sample data to identify functional dependencies. Pearson Education © 2009

Example - Using sample data to identify functional dependencies. Function dependencies between attributes A to E in the Sample relation. A  C (fd1) C  A (fd2) B  D (fd3) A, B  E (fd4) Pearson Education © 2009

Identifying the Primary Key for a Relation using Functional Dependencies Main purpose of identifying a set of functional dependencies for a relation is to specify the set of integrity constraints that must hold on a relation. An important integrity constraint to consider first is the identification of candidate keys, one of which is selected to be the primary key for the relation. All attributes that are not part of a candidate key should be functionally dependent on the key. Pearson Education © 2009

Example - Identify Primary Key for StaffBranch Relation StaffBranch relation has five functional dependencies (see Slide 9). staffNo → sName, position, salary, branchNo, bAddress branchNo → bAddress bAddress → branchNo branchNo, position → salary bAddress, position → salary The determinants are staffNo, branchNo, bAddress, (branchNo, position), and (bAddress, position). To identify all candidate key(s), identify the attribute (or group of attributes) that uniquely identifies each tuple in this relation. The only candidate key and therefore primary key for StaffBranch relation, is staffNo, as all other attributes of the relation are functionally dependent on staffNo. Pearson Education © 2009

Example - Identifying Primary Key for Sample Relation Sample relation has four functional dependencies (see Slide 25). The determinants in the Sample relation are A, B, C, and (A, B). However, the only determinant that functionally determines all the other attributes of the relation is (A, B). (A, B) is identified as the primary key for this relation. Pearson Education © 2009