IT420: Database Management and Organization Normalization 31 January 2006 Adina Crăiniceanu www.cs.usna.edu/~adina.

Slides:



Advertisements
Similar presentations
Relational Terminology. Normalization A method where data items are grouped together to better accommodate business changes Provides a method for representing.
Advertisements

Functional Dependencies and Normalization for Relational Databases
© 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev.
Functional Dependencies and Normalization for Relational Databases.
The Relational Model System Development Life Cycle Normalisation
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke’s Chapter Three: The Relational Model and Normalization.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke’s Chapter Three: The Relational Model and Normalization.
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day 5.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day4.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day5.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 4-1 David M. Kroenke Database Processing Chapter 4 Database Design Using.
Boyce-Codd Normal Form Kelvin Nishikawa SE157a-03 Fall 2006 Kelvin Nishikawa SE157a-03 Fall 2006.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 1-1 COS 346 Day 3.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke Database Processing Chapter 3 Normalization.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day4.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 5 The Relational Model and Normalization.
Chapter 5 Normalization of Database Tables
Why Normalization? To Reduce Redundancy to 1.avoid modification, insertion, deletion anomolies 2.save space Goal: One Fact in One Place.
NORMALIZATION N. HARIKA (CSC).
Normalization Quiz Tao Li Grant Horntvedt. 1. Which of the following statements is true: a. Normal forms can be derived by inspecting the data in various.
Chapter 3 The Relational Model and Normalization
Normalization B Database Systems Normal Forms Wilhelm Steinbuss Room G1.25, ext. 4041
Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 29 – 04 – 2005.
Web-Enabled Decision Support Systems
A Guide to SQL, Eighth Edition Chapter Two Database Design Fundamentals.
Concepts and Terminology Introduction to Database.
Chapter 5 The Relational Model and Normalization David M. Kroenke Database Processing © 2000 Prentice Hall.
Fundamentals, Design, and Implementation, 9/e. Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/2 Copyright.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 4 This material was developed by Oregon Health & Science.
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
Chapter 4 The Relational Model and Normalization.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall, Modified by Dr. Mathis 3-1 David M. Kroenke’s Chapter Three: The Relational.
Functional Dependencies and Normalization for Relational Databases.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
1 Functional Dependencies and Normalization Chapter 15.
IST 210 Normalization 2 Todd Bacastow IST 210. Normalization Methods Inspection Closure Functional dependencies are key.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
Gegevens Analyse Les 3: Normaliseren. Chapter Premise We have received one or more tables of existing data The data is to be stored in a new database.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 What Makes Determinant Values Unique? A determinant is unique in.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Four: Database Design Using Normalization 4-1 KROENKE.
Gegevens Analyse Les 4: Normaliseren. Functional Dependency Rules If A  (B, C), then A  B and A  C If (A,B)  C, then neither A nor B determines C.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke’s Chapter Three: The Relational Model and Normalization.
Ch 7: Normalization-Part 1
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.
Al-Imam University Girls Education Center Collage of Computer Science 1 st Semester, 1432/1433H Chapter 10_part 1 Functional Dependencies and Normalization.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Four: Database Design Using Normalization.
Logical Database Design and Relational Data Model Muhammad Nasir
David M. Kroenke and David J. Auer Database Processing: F undamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
Normal Forms 1NF – A table that qualifies as a relation is in 1NF. (Back)(Back) 2NF – A relation is in 2NF if all of its nonkey attributes are dependent.
Adapted from DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 Functional Dependencies and Normalization.
CSIS 115 Database Design and Applications for Business
A brief summary of database normalization
Database Processing: David M. Kroenke’s Chapter Four:
Database Design Using Normalization
The Relational Model and Normalization
part 1 with pages 1-32 and part 2 with pages 33-69
Database Processing: Chapter Four: Using Normalization
Database Processing: David M. Kroenke’s Chapter Three:
David M. Kroenke and David J
Presentation transcript:

IT420: Database Management and Organization Normalization 31 January 2006 Adina Crăiniceanu

Kroenke, Database Processing Previously on IT420  Database design  Entity-Relationship (ER) Model  Relational Model  Transform ER to relational model  Database Implementation  SQL

Kroenke, Database Processing Goal  Refresh ER to Relational  Normalization

Kroenke, Database Processing ER to Relational  ER:  Entities  identifiers  Relationships  cardinality  Relational model  Tables  Constraints

Kroenke, Database Processing ER to Relational  Transform entities in tables  Transform relationships using foreign keys  Specify logic for enforcing minimum cardinalities

Kroenke, Database Processing Class Exercise: Transform ER model into Relational Model

Kroenke, Database Processing Outline  ER to Relational  Normalization

Kroenke, Database Processing Premise  We have received one or more tables with data  The data is to be stored in a new database  QUESTION: Should the data be stored as received, or should it be transformed for storage?

Kroenke, Database Processing Data Redundancy NumberLastNameFirstName RatingWage Application constraint: All employees with same rating have the same wage (Rating  Wage) Problems due to data redundancy?

Kroenke, Database Processing Modification Anomalies  Deletion Anomaly: What if we delete all employees with rating 8?  Insertion Anomaly: What if we have a new employee with new rating 12?  Update Anomaly: What if we change the wage for rating 7 to be 27?

Kroenke, Database Processing Update Anomalies  The EMPLOYEE table before and after an incorrect update operation on Wage for Rating = 7 NumberLastNameFirstName RatingWage NumberLastNameFirstName RatingWage

Kroenke, Database Processing Table decomposition NumberLastNameFirstName RatingWage NumberLastNameFirstName Rating RatingWage Problem?

Kroenke, Database Processing Decisions  Do we have to decompose / merge?  How do we identify problems caused by redundancy?  Functional dependencies

Kroenke, Database Processing Functional Dependency (FD)  A functional dependency: the value of one (a set of) attribute(s) determines the value of a second (set of) attribute(s): Alpha  MIDNName Alpha  (DormName, DormRoom)  The attribute on the left side of the functional dependency is called the determinant  Functional dependencies may be based on equations: Charge = NbHours X HourlyPrice (NbHours, HourlyPrice)  Charge  Function dependencies are not equations!

Kroenke, Database Processing Functional Dependencies Are Not Equations ObjectColor  Weight ObjectColor  Shape ObjectColor  (Weight, Shape)

Kroenke, Database Processing Composite Determinants  Composite determinant: A determinant of a functional dependency that consists of more than one attribute  (StudentName, ClassName)  Grade  (NbHours, HourlyPrice)  Charge

Kroenke, Database Processing Functional Dependency (FD) Rules  If A  (B, C), then A  B and A  C  If (A,B)  C, then neither A nor B determines C by itself

Kroenke, Database Processing FD Facts  A functional dependency is a statement about all allowable instances of a table  You cannot find the functional dependencies simply by looking at some data:  Data set limitations  Must be logically a determinant  Given some data in a table R, we can check if it violates some FD, but we cannot tell if the FD holds over R!

Kroenke, Database Processing Functional Dependencies in the SKU_DATA Table Assuming data is representative, determine the FD

Kroenke, Database Processing Functional Dependencies in the SKU_DATA Table SKU  (SKU_Description, Department, Buyer) SKU_Description  (SKU, Department, Buyer) Buyer  Department

Kroenke, Database Processing Class Exercise Assuming all FD that are verified by the data are indeed FD, determine the FD in the ORDER_ITEM Table

Kroenke, Database Processing What Makes Determinant Values Unique?  A determinant is unique in a relation if, and only if, it determines every other column in the relation  Unique determinants = superkey

Kroenke, Database Processing Key  A set of columns is a key for a relation if : 1. No two distinct rows can have same values in all key columns, and 2. This is not true for any subset of the key  Part 2 false? A superkey  Primary key  Alternate key

Kroenke, Database Processing Normal Forms  Relations are categorized as a normal form based on which modification anomalies or other problems that they are subject to:

Kroenke, Database Processing Normal Forms  Boyce-Codd Normal Form (BCNF) – A relation is in BCNF if every determinant is a candidate key “I swear to construct my tables so that all nonkey columns are dependent on the key, the whole key and nothing but the key, so help me Codd.”

Kroenke, Database Processing Eliminating Modification Anomalies from Functional Dependencies in Relations  Put all relations into Boyce-Codd Normal Form (BCNF):

Kroenke, Database Processing Putting a Relation into BCNF: EQUIPMENT_REPAIR

Kroenke, Database Processing Putting a Relation into BCNF: EQUIPMENT_REPAIR EQUIPMENT_REPAIR (ItemNumber, Type, AcquisitionCost, RepairNumber, RepairDate, RepairAmount) ItemNumber  (Type, AcquisitionCost) RepairNumber  (ItemNumber, Type, AcquisitionCost, RepairDate, RepairAmount) ITEM (ItemNumber, Type, AcquisitionCost) REPAIR (ItemNumber, RepairNumber, RepairDate, RepairAmount) Where REPAIR.ItemNumber must exist in ITEM.ItemNumber

Kroenke, Database Processing Putting a Relation into BCNF: New Relations

Kroenke, Database Processing Class Exercise Put the following relation into BCNF

Kroenke, Database Processing Multivalued Dependencies  A multivalued dependency occurs when a determinant determines a particular set of values: Employee  Degree Employee  Sibling PartKit  Part  The determinant of a multivalued dependency can never be a primary key

Kroenke, Database Processing Multivalued Dependencies

Kroenke, Database Processing Eliminating Anomolies from Multivaled Dependencies  Multivalued dependencies are not a problem if they are in a separate relation, so:  Always put multivalued dependencies into their own relation  This is known as Fourth Normal Form (4NF)