Normalization. Introduction Badly structured tables, that contains redundant data, may suffer from Update anomalies : Insertions Deletions Modification.

Slides:



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

The Relational Model System Development Life Cycle Normalisation
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
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.
Chapter 5 Normalization Transparencies © Pearson Education Limited 1995, 2005.
INFO 340 Lecture 7 Functional Dependency, Normalization.
Chapter 5 Normalization of Database Tables
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
LOGICAL DATABASE DESIGN
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
Chapter 5 Normalization of Database Tables
FUNCTIONAL DEPENDENCIES
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,
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 13 Normalization Transparencies. 2 Last Class u Access Lab.
Concepts of Database Management, Fifth Edition
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables.
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: >
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
Normalization Transparencies
CSC271 Database Systems Lecture # 28.
MS Access: Creating Relational Databases Instructor: Vicki Weidler Assistant: Joaquin Obieta.
Team Dosen UMN Database Design Connolly Book Chapter
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
Chapter 13 Normalization Transparencies. 2 Chapter 13 - Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification.
CSE314 Database Systems Basics of Functional Dependencies and Normalization for Relational Databases Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E.
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.
Chapter 9 Logical Database Design : Mapping ER Model To Tables.
Normalization Transparencies 1. ©Pearson Education 2009 Objectives How the technique of normalization is used in database design. How tables that contain.
©NIIT Normalizing and Denormalizing Data Lesson 2B / Slide 1 of 18 Objectives In this section, you will learn to: Describe the Top-down and Bottom-up approach.
Chapter 13 Normalization Transparencies. 2 Chapter 13 - Objectives u How to undertake process of normalization. u How to identify most commonly used normal.
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,
Normalization Example. Database Systems, 8 th Edition 2 Database Tables and Normalization Normalization –Process for evaluating and correcting table structures.
Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Lecture 4: Logical Database Design and the Relational Model 1.
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.
NORMALIZATION.
5 1 Normalization of Database Tables. 5 2 Database Tables and Normalization Normalization –Process for evaluating and correcting table structures to minimize.
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
Chapter 8 Relational Database Design Topic 1: Normalization Chuan Li 1 © Pearson Education Limited 1995, 2005.
Normalizing Database Designs. 2 Objectives In this chapter, students will learn: –What normalization is and what role it plays in the database design.
Normalization.
Normalization DBMS.
Functional Dependencies
Chapter 14 Normalization
Database Normalization
Chapter 14 & Chapter 15 Normalization Pearson Education © 2009.
Chapter 14 Normalization – Part I Pearson Education © 2009.
Normalization Dale-Marie Wilson, Ph.D..
Chapter 14 Normalization.
Minggu 9, Pertemuan 18 Normalization
Chapter 14 Normalization.
Normalization February 28, 2019 DB:Normalization.
國立臺北科技大學 課程:資料庫系統 2015 fall Chapter 14 Normalization.
DATABASE DESIGN & DEVELOPMENT
Presentation transcript:

Normalization

Introduction Badly structured tables, that contains redundant data, may suffer from Update anomalies : Insertions Deletions Modification Bad structure may occur due to : Errors in the original ER diagram. Or in the process of translating ER models into tables.

Database Tables and Normalization Normalization is a technique to support the design of databases based on relational model Normalization helps reduce data redundancies and helps eliminate the data anomalies. Normalization works through a series of stages called normal forms: –First normal form (1NF) –Second normal form (2NF) –Third normal form (3NF) The highest level of normalization is not always desirable.

© Pearson Education Limited, Data redundancy and update anomalies Major aim of relational database design is to group columns into tables to minimize data redundancy and reduce file storage space required by base tables.

Staff(staffNo, name, position, salary, branchNo) Primary key staffNo Foreign key branchNo references Branch(branchNo) Branch(branchNo, branchAddress, TelNo) Primary key branchNo Foreign key branchNo references Branch(branchNo) StaffBranch(staffNo, name, position, salary, branchNo, branchAddress,TelNo) Primary key staffNo Data redundancy and update anomalies Major aim of relational database design is to group columns into tables to minimize data redundancy and reduce file storage space required by base tables

© Pearson Education Limited, Data redundancy and update anomalies

7

© Pearson Education Limited, What is the problem ? StaffBranch table has redundant data; the details of a branch (branchAddress and telNo) are repeated for every member of staff located at that branch. In contrast, in Branch table the branch information appears only once for each branch and only the branch number (branchNo) is repeated in the Staff table, to represent where each member of staff is located. Tables having redundant data may suffer from update anomalies (insertion, deletion or modification anomalies)

© Pearson Education Limited, Insertion anomalies How to insert the details of a new member of staff at branch B002 into the StaffBranch table ? Any problem with the tables separated ?

© Pearson Education Limited, Insertion anomalies (1) To insert the details of a new member of staff at branch B002 into the StaffBranch table, we must enter the correct details of Branch B002 so that the branch details are consistent with values for branch B002 in other records of StaffBranch table. No problem with the tables separated, because no need to enter the details, just the foreign key is enough.

© Pearson Education Limited, Insertion anomalies(2) How to insert the details of a new branch that currently has no member of staff into StaffBranch table ? Any problem with the tables separated ?

© Pearson Education Limited, Insertion anomalies(2) To insert the details of a new branch that currently has no member of staff into StaffBranch table, it is necessary to enter null into the staff-related column, such as StaffNo (the primary key). This violates entity integrity and not allowed No problem with the tables separated. We just enter the new brach in the branch table ?

© Pearson Education Limited, Deletion anomalies What happen if we delete a record from the StaffBranch table that represent the last member of staff located at a branch ? Any problem with the tables separated, Why ?

© Pearson Education Limited, Deletion anomalies If we delete a record from the StaffBranch table that represent the last member of staff located at a branch, details about the branch are also lost from the database. No problem with the tables separated, because branch records are stored separately

© Pearson Education Limited, Modification anomalies What if we change of the value of one of the columns of a particular branch in the StaffBranch table (ex: telephone number)?

© Pearson Education Limited, Modification anomalies We must update the records of all staff located at that branch

© Pearson Education Limited, First normal form (1NF) Definition A table in which the intersection of every column and record contains only one value. Only 1NF is critical in creating appropriate tables for relational databases. All subsequent normal forms are optional. However to avoid update anomalies, proceed to 3NF

© Pearson Education Limited, Problem : Column telNos does not comply with 1NF, because there are multiple values at the intersection of the telNos column with every record. How to solve the problem ?

© Pearson Education Limited, Solution : create a separate table BranchTelephone to hold the telephone numbers of branches, by removing telNo column from Branch table NOTE : Primary key of the new table BranchTelephone table is the new telNo column

© Pearson Education Limited, Functional dependency The particular relationships that we show between the columns of a table are more formally referred to as functional dependencies. Functional dependency describes the relationship between columns in a table.

Functional dependency Functional dependency in a table indicate how columns relate to one another. Column B is functionally dependent on column A (A→B) = if we know the value of A, we find only one value of B in all records that has this value of A. We say that B is worked out from A However, for a given value of B there may be several values of A

© Pearson Education Limited, Problem : TempStaffAllocation table is not in 2NF, why ? No primary-key columns primary-key columns Functional dependency

© Pearson Education Limited, Second normal form (2NF) A table in 2NF is one that is :  1NF  Each non-primary-key column can be worked out from the values in all the columns that make up the primary key (primary-key columns). This means every non-primary-key column is fully functional dependent on the primary key. Fully means dependent on A but not on any proper subset of A

© Pearson Education Limited, Second normal form (2NF) NB: 2NF only applies only to tables with composite primary keys ( primary key composed of 2 or more columns). NB: 1NF table with a single column primary key is automatically in at least 2NF.

© Pearson Education Limited, Functional dependency  BranchAddress can be worked out from BranchNo (part of the primary key).  Every time B002 appears in branchNo column, the same address ”City center ……..” appears in branchAddress. The reverse is true. (partial dependency)  Name and position can be worked out from staffNo (part of the primary key).  Every time S455 appears in staffNo column, the name “Ellen Layman” and position “assistant” appears in name and position columns ( partial dependency)

© Pearson Education Limited, Functional dependency  hoursPerWeek can be worked only out from both staffNo and BranchNo ( the whole primary key). As a partial dependency exists on the primary key, the table is not 2NF. 2NF is achieved by removing partial dependency. How ?

© Pearson Education Limited, Converting TempStaffAllocation table to 2NF

© Pearson Education Limited, Third normal form (3NF) Definition A table that is in 1NF and 2NF and in which all non-primary-key column can be worked out from only the primary key column(s) and no other columns.

Is StaffBranch table 3NF? Draw the dependency arrows ?

© Pearson Education Limited, StaffBranch table is not in 3NF

© Pearson Education Limited, Converting the StaffBranch table to 3NF