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.

Slides:



Advertisements
Similar presentations
Boyce-Codd NF Takahiko Saito Spring 2005 CS 157A.
Advertisements

The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 7 th Edition.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.
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.
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 5-1 COS 346 Day 9.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day 5.
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 6-1 David M. Kroenke Database Processing Chapter 6 Transforming Data.
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.
Normalization of Database Tables
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 6-1 David M. Kroenke’s Chapter Six: Transforming Data Models into Database.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day4.
The Relational Model Chapter Two (Excerpts) DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
© 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
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 5 th Edition.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 David M. Kroenke’s Chapter Six: Transforming ER Models into Database.
Why Normalization? To Reduce Redundancy to 1.avoid modification, insertion, deletion anomolies 2.save space Goal: One Fact in One Place.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 David M. Kroenke’s Chapter Six: Transforming ER Models into Database.
NORMALIZATION N. HARIKA (CSC).
Chapter 3 The Relational Model and Normalization
SQL Normalization Database Design Lecture 5. Copyright 2006Page 2 SQL Normalization Database Design 1 st Normal Form 1 st Normal Form 2 nd Normal Form.
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.
IT420: Database Management and Organization Normalization 31 January 2006 Adina Crăiniceanu
Chapter 4 The Relational Model and Normalization.
The Relational Model and Normalization R. Nakatsu.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
Your name here. Improving Schemas and Normalization What are redundancies and anomalies? What are functional dependencies and how are they related to.
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.
The Relational Model Chapter Two DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3 rd Edition.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
Chapter 2. The Relational Model IST2101. Chapter 1 Review Potential problems with Lists – Deletion – Update – Insertion Avoid these problems using a relational.
Slide 1 Chapter 03 The Relational Model and Normalization.
Unit 4 Object Relational Modeling. Key Concepts Object-Relational Modeling outcomes and process Relational data model Normalization Anomalies Functional.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
+ Relational Model IST210 Class Lecture. + Premiere Products A new company that is going to sells random merchandise via sales representatives You have.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 What Makes Determinant Values Unique? A determinant is unique in.
Gegevens Analyse Les 5: van ERD naar DSD.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 4 th Edition.
Functional dependencies and normalization 1 Normalization Functional dependencies NF + BCNF.
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.
FEN Introduction to the database field: The development process Seminar: Introduction to relational databases Development process: Analyse.
Week 4 Lecture Part 1 of 3 Normalization of Database Tables Samuel ConnSamuel Conn, Asst. Professor.
Normalization ACSC 425 Database Management Systems.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
SLIDE 1IS 257 – Fall 2006 Normalization Normalization theory is based on the observation that relations with certain properties are more effective.
David M. Kroenke and David J. Auer Database Processing: F undamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
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
The Relational Model and Database Normalization
The Relational Model Chapter Two DATABASE CONCEPTS, 3rd Edition
Database Design Using Normalization
The Relational Model and Normalization
part 1 with pages 1-32 and part 2 with pages 33-69
Database Processing: David M. Kroenke’s Chapter Three:
David M. Kroenke and David J
Copyright © 2018, 2015, 20 Pearson Education, Inc. All Rights Reserved Database Concepts Eighth Edition Chapter # 2 The Relational Model.
Chapter 4 The Relational Model and Normalization
Presentation transcript:

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 QUESTION: Should the data be stored as received, or should it be transformed for storage?

How Many Tables? Should we store these two tables as they are, or should we combine them into one table in our new database? Of moeten we er meer tabellen van maken?!? (FW)

Relation Relational DBMS products store data about entities in relations, which are a special type of table A relation is a two-dimensional table that has the following characteristics: –Rows contain data about an entity –Columns contain data about attributes of the entity –All entries in a column are of the same kind –Each column has a unique name –Cells of the table hold a single value –The order of the columns is unimportant –The order of the rows is unimportant –No two rows may be identical

A Relation

Relaties in en tussen entiteiten De relaties tussen attributen in een relatie kunnen het zelfde als relaties tussen entiteiten behandeld worden. D.w.z: 1:1, 1:n, n:m

A Relation with Values of Varying Length

Tables That Are Not Relations: Multiple Entries per Cell

Tables That Are Not Relations: Table with Required Row Order

Functional Dependency A functional dependency occurs when the value of one (a set of) attribute(s) determines the value of a second (set of) attribute(s): StudentID  StudentName StudentID  (DormName, DormRoom, Fee) The attribute on the left side of the functional dependency is called the determinant Functional dependencies may be based on equations: ExtendedPrice = Quantity X UnitPrice (Quantity, UnitPrice)  ExtendedPrice Function dependencies are not equations! Functional Dependency = Functionele afhankelijkheid

Meerwaardige afhankelijkheid Wanneer twee attributen elkaar niet bepalen en een N:M relatie hebben, dan noemen we dat een meerwaardige afhankelijkheid. Student_ID : Vak(_ID) = N:M Student_ID →→ Vak_ID Of Vak_ID →→ Student_ID (Dit zien we pas terug bij les 4)

Composite Determinants Composite determinant: A determinant of a functional dependency that consists of more than one attribute (StudentName, ClassName)  (Grade)

Functional Dependency Rules If A  (B, C), then A  B and A  C If (A,B)  C, then neither A nor B determines C by itself

Functional Dependencies in the SKU_DATA Table

SKU  (SKU_Description, Department, Buyer) SKU_Description  (SKU, Department, Buyer) Buyer  Department

Candidate and Primary Keys A candidate key is a key that determines all of the other columns in a relation A primary key is a candidate key selected as the primary means of identifying rows in a relation: –There is one and only one primary key per relation –The primary key may be a composite key –The ideal primary key is short, numeric and never changes

Surrogate Keys NOTE: The primary key of the relation is underlined below: RENTAL_PROPERTY without surrogate key: RENTAL_PROPERTY (Street, City, State/Province, Zip/PostalCode, Country, Rental_Rate) RENTAL_PROPERTY with surrogate key: RENTAL_PROPERTY (PropertyID, Street, City, State/Province, Zip/PostalCode, Country, Rental_Rate)

Foreign Keys A foreign key is the primary key of one relation that is placed in another relation to form a link between the relations: –A foreign key can be a single column or a composite key –The term refers to the fact that key values are foreign to the relation in which they appear as foreign key values

Modification Anomalies Deletion Anomaly Insertion Anomaly Update Anomaly

Modification Anomalies The EQUIPMENT_REPAIR table before and after an incorrect update operation on AcquisitionCost for Type = Drill Press:

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

Normal Forms 1NF – A table that qualifies as a relation is in 1NF 2NF – A relation is in 2NF if all of its nonkey attributes are dependent on all of the primary key [FW] of attribuut is afhankelijk van ander niet-sleutel-attribuut. 3NF – A relation is in 3NF if it is in 2NF and has no determinants except the primary key 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.”

2e NF ? SnrActiviteitContributie 100zwemmen€50 200zwemmen€50 100Fietsen€30 100Boksen€80 200Fietsen€30 300Fietsen€30 300Boksen€80

2e NF oplossing: Nee Snr → → Activiteit Activiteit → Contributie Sleutel: Snr + Activiteit Dus Contributie is afhankelijk van deel sleutel!

Oplossing: SPLITSEN! Tabel 1: Snr + Activiteit Tabel 2: Activiteit + Contributie

3e NF? SnrHuisHuur 1A50 2A 3B70 4B 5C50

BCNF? SnrVakStaflid 100WisCauchy 150PsyJung 200WisRiemann 300NatEinstein 450BPMWagenaar Snr + Vak → Staflid,kandidaatsleutel: Snr+Vak Snr + Staflid → Vakkandidaatsleutel: Snr+Staflid Staflid → Vak