Chapter 3 The Relational Model and Normalization

Slides:



Advertisements
Similar presentations
Chapter 5 Normalization of Database Tables
Advertisements

More about Functional Dependencies and Normalization.
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.
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.
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 COS 346 Day 10.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 COS 346 Day 8.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 COS 346 Day 7.
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.
© 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.
July 14, 2015ICS 424: recap1 Relational Database Design: Recap of ICS 324.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
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.
A Guide to SQL, Eighth Edition Chapter Two Database Design Fundamentals.
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
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 4 This material was developed by Oregon Health & Science.
© 2002 by Prentice Hall 1 Database Design David M. Kroenke Database Concepts 1e Chapter 5 5.
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 4 The Relational Model and Normalization.
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
The Relational Model and Normalization R. Nakatsu.
1 A Guide to MySQL 2 Database Design Fundamentals.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
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.
The Relational Model and Normalization The Relational Model Normalization First Through Fifth Normal Forms Domain/Key Normal Form The Synthesis of Relations.
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.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
Slide 1 Chapter 03 The Relational Model and Normalization.
Component 4/Unit 6d Topic IV: Design a simple relational database using data modeling and normalization Description and Information Gathering Data Model.
Relational Model & Normalization Relational terminology Anomalies and the need for normalization Normal forms Relation synthesis De-normalization.
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.
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.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 4 th Edition.
Logical Database Design and the Relational Model.
Lecture 4: Logical Database Design and the Relational Model 1.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 5 The Relational Model and Normalization.
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.
Logical Database Design and Relational Data Model Muhammad Nasir
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.
5. The Relational Model and Normalization 5.1 Relational Model5.2 Normalization 5.3 1NF to 5NF 5.4 Domain/Key Normalization 5.5 Synthesis of Relation 5.6.
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 Normalization
Relational Model and ER Model: in a Nutshell
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:

Chapter 3 The Relational Model and Normalization CS420 Western Oregon University

Relations Relational DBMS products store data in the form of relations, 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 Although not all tables are relations, the terms table and relation are normally used interchangeably Table/row/column = file/record/field = relation/tuple/attribute

Example: Relation

Example: Tables Not Relations

Types of Keys A key is one or more columns of a relation that identifies a row Composite key is a key that contains two or more attributes A Surrogate Key is an artificial column added to a table to serve as the primary key A foreign key is a column or set of columns that is the primary of another table A relation has one unique primary key and may also have additional unique keys called candidate keys Primary key is used to Represent the table in relationships Organize table storage Generate indexes Sometimes, relations are denoted by showing the name of the relation followed by the columns of the relation in parentheses. The primary key of the relation is underlined.

Functional Dependencies A functional dependency occurs when the value of one (set of) attribute(s) determines the value of a second (set of) attribute(s) The attribute on the left side of the functional dependency is called the determinant SID  GPA SKU  Department, SKU_Description (CustomerNumber, ItemNumber, Quantity)  Price While a primary key is always a determinant, a determinant is not necessarily a primary key

Normalization Normalization eliminates modification anomalies Deletion anomaly: deletion of a row loses information about two or more entities Insertion anomaly: insertion of a fact in one entity cannot be done until a fact about another entity is added Anomalies can be removed by splitting the relation into two or more relations; each with a different, single theme Normalization works through classes of relations called normal forms

Relationship of Normal Forms

Normal Forms Any table of data is in 1NF if it meets the definition of a relation A relation is in 2NF if all its non-key attributes are dependent on all of the key (no partial dependencies) If a relation has a single attribute key, it is automatically in 2NF A relation is in 3NF if it is in 2NF and has no transitive dependencies A relation is in BCNF if every determinant is a candidate key A relation is in fourth normal form if it is in BCNF and has no multi-value dependencies

Example: 2NF

Example: NOT IN 3NF

Example: 3NF

Example: NOT IN BCNF

Example: BCNF

Example: NOT IN 4NF

Example: 4NF

DK/NF First published in 1981 by Fagin DK/NF has no modification anomalies; so no higher normal form is needed A relation is in DK/NF if every constraint on the relation is a logical consequence of the definition of keys and domains

Example 1: DK/NF

Example: DK/NF

Example 2: DK/NF

Example: DK/NF

Normal Forms-Review Any table of data is in 1NF if it meets the definition of a relation A relation is in 2NF if all its non-key attributes are dependent on all of the key (no partial dependencies) If a relation has a single attribute key, it is automatically in 2NF A relation is in 3NF if it is in 2NF and has no transitive dependencies A relation is in BCNF if every determinant is a candidate key A relation is in fourth normal form if it is in BCNF and has no multi-value dependencies

The Synthesis of Relations Given a set of attributes with certain functional dependencies, what relations should we form? Example: A and B are two attributes If A  B and B  A A and B have a one-to-one attribute relationship If A  B, but B not  A A and B have a many-to-one attribute relationship If A not  B and B not  A A and B have a many-to-many attribute relationship

Types of Attribute Relationship

One-to-One Attribute Relationships Attributes that have a one-to-one relationship must occur together in at least one relation Call the relation R and the attributes A and B: Either A or B must be the key of R An attribute can be added to R if it is functionally determined by A or B An attribute that is not functionally determined by A or B cannot be added to R A and B must occur together in R, but should not occur together in other relations Either A or B should be consistently used to represent the pair in relations other than R

Many-to-One Attribute Relationships Attributes that have a many-to-one relationship can exist in a relation together Assume C determines D in relation S C must be the key of S An attribute can be added to S if it is determined by C An attribute that is not determined by C cannot be added to S

Many-to-Many Attribute Relationships Attributes that have a many-to-many relationship can exist in a relation together Assume attributes E and F reside together in relation T The key of T must be (E, F) An attribute can be added to T if it is determined by the combination (E, F) An attribute may not be added to T if it is not determined by the combination (E, F) If adding a new attribute, G, expands the key to (E, F, G), then the theme of the relation has been changed Either G does not belong in T or the name of T must be changed to reflect the new theme

De-normalized Designs When a normalized design is unnatural, awkward, or results in unacceptable performance, a de-normalized design is preferred Example Normalized relation CUSTOMER (CustNumber, CustName, Zip) CODES (Zip, City, State) De-Normalized relations CUSTOMER (CustNumber, CustName, City, State, Zip)