Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Chapter 3 Database Normalization 1.

Slides:



Advertisements
Similar presentations
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
Advertisements

Jump to first page Normalization Jump to first page Topics n Why normalization is needed n What causes anomalies n What the 4 normal forms are n How.
Chapter 8 Normal Forms Based on Functional Dependencies Deborah Costa Oct 18, 2007.
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Boyce-Codd Normal Form Kelvin Nishikawa SE157a-03 Fall 2006 Kelvin Nishikawa SE157a-03 Fall 2006.
Normalization I.
Chapter 5 Normalization Transparencies © Pearson Education Limited 1995, 2005.
Databases 6: Normalization
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
Chapter 3 The Relational Model and Normalization
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Week 6 Lecture Normalization
Lecture 12 Inst: Haya Sammaneh
Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Chapter 3 Database Normalization 1.
Chapter 5 The Relational Model and Normalization David M. Kroenke Database Processing © 2000 Prentice Hall.
Logical Database Design ( 補 ) Unit 7 Logical Database Design ( 補 )
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,
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
Chapter 4 The Relational Model and Normalization.
Chapter 13 Normalization Transparencies. 2 Last Class u Access Lab.
Concepts of Database Management, Fifth Edition
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: >
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
Normalization Transparencies
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.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Lecture No 14 Functional Dependencies & Normalization ( III ) Mar 04 th 2011 Database Systems.
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.
In this session, you will learn to: Describe data redundancy Describe the first, second, and third normal forms Describe the Boyce-Codd Normal Form Appreciate.
Dr. Mohamed Osman Hegaz1 Logical data base design (2) Normalization.
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 MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
Brian Thoms.  Databases normalization The systematic way of ensuring that a database structure is suitable for general-purpose querying and free of certain.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
ITD1312 Database Principles Chapter 4C: Normalization.
Normal Forms (Part 1) Steven Le ~ CS157B. Normalization is a systematic way of ensuring that a database structure is suitable for general-purpose querying.
Database Architecture Normalization. Purpose of Normalization A technique for producing a set of relations with desirable properties, given the data requirements.
SLIDE 1IS 257 – Fall 2006 Normalization Normalization theory is based on the observation that relations with certain properties are more effective.
Database Normalization. What is Normalization Normalization allows us to organize data so that it: Normalization allows us to organize data so that it:
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Chapter 3 Database Normalization 1.
Chapter 8 Relational Database Design Topic 1: Normalization Chuan Li 1 © Pearson Education Limited 1995, 2005.
Normalization.
Understanding Data Storage
Normalization (Database Design)
Normalization Karolina muszyńska
A brief summary of database normalization
Database Normalization
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
The Relational Model and Normalization
Database Normalization
Chapter 6 Normalization of Database Tables
Chapter 14 Normalization – Part I Pearson Education © 2009.
Normalization Dale-Marie Wilson, Ph.D..
Normalization.
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Normalization Normalization theory is based on the observation that relations with certain properties are more effective in inserting, updating and deleting.
Chapter 14 Normalization.
Unit 7 Normalization (表格正規化).
國立臺北科技大學 課程:資料庫系統 2015 fall Chapter 14 Normalization.
Chapter 4 The Relational Model and Normalization
Presentation transcript:

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Chapter 3 Database Normalization 1

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Sections Database Anomalies What is Normalization? The Normal Forms 2

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Database Design Database design demands the decision of a suitable logical structure Most importantly What relations are needed to store the values What attributes they should use And the optimization of relation design for clarity and efficiency 3

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Data Anomalies Edgar Codd, inventor of the relational database, described data anomalies in the 70s They are unintended consequences of a database modification There are 3 kinds of anomalies: Insert Anomaly Delete Anomaly Update Anomaly 4

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Insert Anomaly Insert anomalies happen when data is inserted into the relation that has attributes missing (null attributes) If we view the relation as a set where every tuple is its own key, then this is an illegal operation We don’t want the database to have holes in its information 5

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Delete Anomaly If database is not normalized, then deleting a from a relation could result in a deletion of other wanted information Example of insert and delete anomalies on next page: 6

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Insert anomaly: Because P# is empty Delete anomaly: If S5 is deleted, then all information about S5, salary, status 30, Athens is lost 7 S #Salary STATUS CITYP # QTY S LONDONP1300 S LONDONP2200 S LONDONP3400 S LONDONP4200 S LONDONP5100 S LONDONP6100 S PARISP1300 S PARISP2400 S PARISP2200 S LONDONP2200 S LONDONP4300 S LONDONP5400 S ATHENS -

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Update Anomaly If a database is not normalized, updating a single fact in the database becomes very inefficient and sometimes incorrect That fact can be in many relations, so only updating one relation would not be sufficient Therefore, many relations must be updated to accurately reflect the update… if this is not done then the update is not accurate. 8

Dr. T. Y. Lin | SJSU | CS 157A | Fall If S1 is changed then many updates have to be issued for a single attribute change Why not issue single change to single relation? S #Salary STATUS CITYP # QTY S LONDONP1300 S LONDONP2200 S LONDONP3400 S LONDONP4200 S LONDONP5100 S LONDONP6100 S PARISP1300 S PARISP2400 S PARISP2200 S LONDONP2200 S LONDONP4300 S LONDONP5400

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 What is Normalization? Normalization is a formalized process of decomposing relations Normalized relations aim to remove redundancy and dependencies from relations By doing this, data anomalies are prevented But also, normalization is also the basis for designing simpler, clearer, faster, and more efficient RDBMS’s 10

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Normal Forms Data anomalies were described by Codd in 1970s He and others (Boyce, Fagin, more) also began defining Normal Forms that could describe how rigorous the normalization is-- Normal Forms A Normal Form is the specific form a relation is in when it satisfies specific properties These properties provide a systematic way of formulating non-normalized relations into normalized relations 11

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Many Normal Forms Relations in higher Normal Forms will be more normalized than relations in lower Normal Forms Every higher Normal Form satisfies every Normal Form lower than it Ex. 2NF is also 1NF, and 3NF is also 2NF and 1NF 1NF, 2NF, 3NF, BCNF, and 4NF will be discussed, however there are even more Normal Forms than these 5. 12

Dr. T. Y. Lin | SJSU | CS 157A | Fall

Dr. T. Y. Lin | SJSU | CS 157A | Fall NF (First Normal Form) For a relation to be in 1NF it must have: Any related values must be decomposed into separate tables All rows must be unique (relational set) All columns must be unique (no repeating groups) Any value in any tuple must be atomic (cannot be divided) A private key must be defined (usually formally defined as the entire tuple, assuming it is unique and the relation is a set) 14

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 Functional Dependencies (FD) Given a relation R, attribute Y of R is functionally dependent on attribute X of R if each X - value in R has associated with it precisely one Y - value in R (at any one time). (no X-values are mapped to two Y-values) A functional dependency is a special form of integrity constraint. In other words, every legal extension ( tabulation ) of that relation satisfies that constraint. An attribute Y is said to be fully functionally dependent on X if Y functionally depends on X but not any proper subset of X. From now on, by FD, we mean full FD. 15

Dr. T. Y. Lin | SJSU | CS 157A | Fall NF (Second Normal Form) SQL is automatically in 1NF, but it is not good enough, in Codd’s own words 16

Dr. T. Y. Lin | SJSU | CS 157A | Fall NF (Third Normal Form) Functional dependencies 17

Dr. T. Y. Lin | SJSU | CS 157A | Fall 2015 BCNF (Boyce-Codd Normal Form) Also known as 3.5 Normal form 18

Dr. T. Y. Lin | SJSU | CS 157A | Fall NF (Fourth Normal Form) 19