The Relational Model and Normalization R. Nakatsu.

Slides:



Advertisements
Similar presentations
Chapter 5 Normalization of Database Tables
Advertisements

5 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Normalization of Database Tables
Chapter 5 Normalization of Database Tables
Chapter 5 Normalization of Database Tables
© 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev.
Chapter 5 Normalization of Database Tables
Normalization of Database Tables Special adaptation for INFS-3200
Normalization of Database Tables
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.
Need for 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 of Database Tables
Normalization of Database Tables
Normalization of Database Tables
© 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.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
NORMALIZATION N. HARIKA (CSC).
Chapter 3 The Relational Model and Normalization
Chapter 5 Normalization of Database Tables
Lecture 12 Inst: Haya Sammaneh
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.
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.
Concepts of Database Management, Fifth Edition
5 1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables.
1 A Guide to MySQL 2 Database Design Fundamentals.
1 DATABASE SYSTEMS DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT Chapter 7 Normalisation.
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.
Logical Database Design Relational Model. Logical Database Design Logical database design: process of transforming conceptual data model into a logical.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
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.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
Database Design – Lecture 8
Database Principles: Fundamentals of Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables Carlos Coronel, Steven.
Normalization of Database Tables
Principles of Database Design, Conclusions MBAA 609 R. Nakatsu.
Data Analysis Improving Database Design. Normalization The process of transforming a data model into a flexible, stable structure. Reduces anomalies Anomaly.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
E-R Modeling: Table Normalization. Normalization of DB Tables Normalization ► Process for evaluating and correcting table structures determines the optimal.
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.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
RELATIONAL TABLE NORMALIZATION. Key Concepts Guidelines for Primary Keys Deletion anomaly Update anomaly Insertion anomaly Functional dependency Transitive.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 5 The Relational Model and Normalization.
Week 4 Lecture Part 1 of 3 Normalization of Database Tables Samuel ConnSamuel Conn, Asst. Professor.
Logical Database Design and Relational Data Model Muhammad Nasir
5 1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
SLIDE 1IS 257 – Fall 2006 Normalization Normalization theory is based on the observation that relations with certain properties are more effective.
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.
Normalizing Database Designs. 2 Objectives In this chapter, students will learn: –What normalization is and what role it plays in the database design.
Normalization Karolina muszyńska
Functional Dependencies
The Relational Model and Normalization
Normalization of Database Tables PRESENTED BY TANVEERA AKHTER FOR BCA 2ND YEAR dated:15/09/2015 DEPT. OF COMPUTER SCIENCE.
Chapter 6 Normalization of Database Tables
DATABASE DESIGN & DEVELOPMENT
Chapter 4 The Relational Model and Normalization
Review of Week 3 Relation Transforming ERD into Relations
Presentation transcript:

The Relational Model and Normalization R. Nakatsu

The Relational Model Data is represented in two-dimensional tables –Each of the tables is a matrix consisting of a series of row/column intersections –Tables are also called relations –Columns of the tables are attributes Information in more than one table can be easily extracted and combined E.F. Codd defined well-structured “normal forms” of relations

Functional Dependency Notation: X  Y Each value of X determines one and only one value of Y Examples: SID  Major, LastName, FirstName ComputerSerialNumber  MemorySize (SID, CourseNumber)  Grade

Functional Dependency What are the functional dependencies in the relation below?

A  B relationships A  B and B  Aone-to-one A  B but B not  Amany-to-one A not  B and B not  Amany-to-many Another way to write not  is . For example: A   B and B   A (A multi-determines B and B multi-determines A)

Key A group of one or more attributes that uniquely identifies a row. A relation has one primary key and may also have additional keys called candidate keys.

Composite Key is a key that contains two or more attributes

Normalization Normalization is a process that assigns attributes (fields) to tables such that data redundancies are eliminated or reduced, thereby reducing the likelihood of data anomalies. Stages of Normalization (Normal Forms): 1NF, 2NF, 3NF, BCNF, 4NF (Ensure that tables are at least 3NF; higher forms are far less likely to be encountered).

Normalization Process Objective: Ensure that each table conforms to the concept of well-formed relations. –Each table represents a single subject –No data item will be unnecessarily stored in more than one table –All nonkey attributes in a table are dependent on the primary key –Each table is void of insertion, update, and deletion anomalies

Anomaly An undesirable consequence of data modification in which two or more different themes are entered (insertion anomaly) in a single row or two or more themes are lost if the row is deleted (deletion anomaly).

Example State the deletion and insertion anomalies. SIDActivityFee 100Skiing Golf Swimming Squash Swimming Swimming Golf 65

First Normal Form (1NF) Any table of data that meets the definition of a relation: No multi-valued attributes allowed. No repeating groups. No two rows can be identical (need a primary key). Order of the rows is insignificant. All entries in a column are of the same kind. Each column must have a unique name.

Table Not in 1NF

Order Table Attributes 1.Order ID 2.Order Date 3.Shipping Date 4.Customer ID 5.Customer Name 6.Shipping Address 7.Book 1 Title 8.Book 1 Price 9.Book 1 Qty 10.Book 2 Title 11.Book 2 Price 12.Book 2 Qty 13. Book 3 Title 14. Book 3 Price 15. Book 3 Qty 16. Book 4 Title 17. Book 4 Price 18. Book 4 Qty 19. Book 5 Title 20. Book 5 Price 21. Book 5 Qty (Title, Price, Qty) is a repeating group Table Not in 1NF

Second Normal Form (2NF) If it is in 1NF and all its nonkey attributes are dependent on all of the key. No partial dependencies are allowed. Partial dependency: Functional dependence in which the determinant is only part of the primary key.

Not in 2NF. Why? SIDActivityFee 100Skiing Golf Swimming Squash Swimming Swimming Golf 65

Tables in 2NF

Third Normal Form (3NF) If it is in 2NF and has no transitive dependencies. Transitive Dependency: One nonkey attribute functionally depends on another nonkey attribute. What is the transitive dependency in this example?

Tables in 3NF

Boyce-Codd Normal Form (BCNF) If it is in 3NF and every determinant is a candidate key. © 2000 Prentice Hall

Database Systems, 9th Edition 22

Fourth Normal Form (4NF) If it is in BCNF and has no multi-valued dependencies. A multi-valued dependency occurs when one key determines multiple values of two other attributes, and those attributes are independent of one another. Given two independent attributes A and B: Key   A Key   B

Not in 4NF. Why? SIDMajorActivity 100MusicSwimming 100AccountingSwimming 100MusicTennis 100AccountingTennis 150MathJogging

Tables in 4NF © 2000 Prentice Hall

Summary of Normal Forms 1NF: Must meet the definition of a relation 2NF: No partial dependencies 3NF: No transitive dependencies BCNF: Every determinant is a candidate key 4NF: No multi-valued dependencies 5NF and DKNF: Not covered (of theoretical interest only) These normal forms are nested.

Dependency Diagram A dependency diagram depicts all dependencies found within given table structure –Helps to get an overview of all relationships among table’s attributes –Makes it less likely that an important dependency will be overlooked –The arrows on the top indicate that the Relation is in 1NF; that is, the primary key determines all other attributes.

Database Systems, 9th Edition 28

Solution

Example: Using ER Diagramming and Normalization Together Employee (Employee Number, Last Name, First Name, Job Class, Hourly Rate) In this example, HourlyRate is dependent on JobClass. What is the problem with this table? Employee NumberLast NameFirst NameJob ClassHourly Rate 11SmithJohnMechanic20 12JonesSusanTechnician18 13McKayBobMechanic20 14OwensPaulaClerk15 ChangSteveMechanic20 16SarandonSarahMechanic20

Solution: Create Two Tables Employee (Employee Number, Last Name, First Name, Job Class ID) Job Class ID is the link to the Job Class table. Employee NumberLast NameFirst NameJob Class ID 11SmithJohn2 12JonesSusan3 13McKayBob2 14OwensPaula1 15ChangSteve2 16SarandonSarah2

Job Class (Job Class ID, Job Class, Hourly Rate) There are no more field dependencies!

De-Normalization Sometimes normalization is not worth it. When a table is split into two or more tables, the cost of the extra processing (i.e., joins) may not be worth it. Controlled Redundancy: For performance reasons, however, it is sometimes appropriate to duplicate data intentionally.