Normalization ACSC 425 Database Management Systems.

Slides:



Advertisements
Similar presentations
Database Design: Normalization J.G. Zheng June 29 th 2005 DB Chapter 4.
Advertisements

The Relational Model DB Chapter 2 (and some from chapter 4, 5) J.G. Zheng June 27 th 2005.
The Relational Model J.G. Zheng May 15 th Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized.
5 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Chapter 5 Normalization of Database Tables
Boyce-Codd NF Takahiko Saito Spring 2005 CS 157A.
Modeling the Data: Conceptual and Logical Data Modeling
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.
1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF Normalisation Process Example Summary.
Normalization I.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
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).
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 4: Logical Database Design and the Relational Model (Part II)
Lecture 12 Inst: Haya Sammaneh
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.
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
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.
Concepts of Database Management Sixth Edition Chapter 5 Database Design 1: Normalization.
The Relational Model and Normalization R. Nakatsu.
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
1 A Guide to MySQL 2 Database Design Fundamentals.
1 Pertemuan 23 Normalisasi Matakuliah: >/ > Tahun: > Versi: >
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
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.
1 A Guide to MySQL 2 Database Design Fundamentals.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
The Relational Model J.G. Zheng Jan 2010 CIS 8040 Database Management Systems.
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.
Lecture Nine: Normalization
Dr. Mohamed Osman Hegaz1 Logical data base design (2) 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.
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,
Lecture 3 Functional Dependency and Normal Forms Prof. Sin-Min Lee Department of Computer Science.
Concepts of Database Management Seventh Edition Chapter 5 Database Design 1: Normalization.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Microsoft Access 2010 Chapter 11 Database Design.
Lecture 4: Logical Database Design and the Relational Model 1.
McGraw-Hill/Irwin Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Modeling the Data: Conceptual and Logical Data Modeling.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
Southern Methodist University CSE CSE 2337 Introduction to Data Management Chapter 5 Part II.
Database Architecture Normalization. Purpose of Normalization A technique for producing a set of relations with desirable properties, given the data requirements.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
Normalization.
INLS 623 – Database Normalization
A Guide to SQL, Eighth Edition
Database, tables and normal forms
Normalization Karolina muszyńska
A brief summary of database normalization
Chapter 6 Normalization of Database Tables
Normalization – Part II
Normalization February 28, 2019 DB:Normalization.
Sampath Jayarathna Cal Poly Pomona
Database Normalization.
Chapter 4 The Relational Model and Normalization
Chapter 14 Normalization Pearson Education © 2009.
Presentation transcript:

Normalization ACSC 425 Database Management Systems

Overview What is normalization? What are the normal forms? How to normalize relations?

Introduction Question: How many, and what, relations (tables) should be used to store my data? Is the current relation free of problems?

Normalization Normalization is a process of producing a set of related relations(tables) with desirable attributes, given the data requirements of a domain The goal is to remove redundancy and other data modification (insertion, update and deletion) problems Usually dividing a table into 2 or more tables Using Normal Forms as a guide

Normal Forms Fewer abnomallies... Normalization …but more tables Normal forms are guidelines (steps) for the normalization process Fewer abnomallies... Normalization …but more tables Unnormalized Form (UNF) 1st Normal Form (1NF) 2nd Normal Form (2NF) 3rd Normal Form (3NF) Boyce Codd Normal Form (BC/NF) 4th Normal Form (4NF) 5th Normal Form DK/NF

Normalization – 1NF A table is in 1NF if it satisfies the definition of a relation Review: what are the characteristics of a relation? No “repeating groups” (columns)

Relation A relation is a two-dimensional table that has specific characteristics: The table consist of rows and columns Rows contain data about entity instances All values in a row describes the same entity instance Columns contain data about attributes of the entity All values in a column are of the same kind 7

Relation (continued) Relation’s specific characteristics go on: Each row is distinct A Cell of the table hold a single value Each column has a unique name The order of the rows is unimportant The order of the columns is unimportant 8

Repeating Groups Customer ID First Name Surname Telephone Number 123 Robert Ingram 555-861-2025 456 Jane Wright 555-403-1659 555-776-4100 789 Maria Fernandez 555-808-9633 Customer ID First Name Surname Tel. No. 1 Tel. No. 2 Tel. No. 3 123 Robert Ingram 555-861-2025 456 Jane Wright 555-403-1659 555-776-4100 789 Maria Fernandez 555-808-9633

Transforming to 1NF Transforming to rows, rather than columns Customer ID First Name Surname Telephone Number 123 Robert Ingram 555-861-2025 456 Jane Wright 555-403-1659 555-776-4100 789 Maria Fernandez 555-808-9633

Transforming to 1NF: Example Another example UNF 1NF

Problems in 1NF Basically has the same problem as the spreadsheet tables Redundancy Data may be inconsistent after modification

Non-Relation Examples Single value Column same kind, row describes the complete instance 13

Non-Relation Examples (2) Emp_Name Emp_Age Emp_Phone Emp_Email Jordan Hail 45 404-652-6325 678-584-1754 JH@work.com, JH@home.com Jack Parsons 28 404-652-8745 404-321-5687 JP@work.com Tom Jackson 23 678-854-1245 770-415-8415 TJ@work.com, TJ@home.com Liz Marsten Thirty 404-884-8753 404-697-2587 RM@work.com, RM@home.com Single value Column same kind, row describes the complete instance 14

Higher Normal Forms Normal forms higher than 1NF deal with functional dependency Identifying the normal form level by analyzing the functional dependency between attributes (fields)

Functional Dependency If each value of attribute A is associated with only one value of attribute B, we say A determines B Or, B is dependent on A Denoted as: A  B Functional dependence describes relationships between attributes (not relations) Note: A (or B) could be a set of fields

Functional Dependency Examples For each SSN, there is only one corresponding first name (or last name), so: SSN determines FirstName SSN  FirstName Non-dependency example Each instructor teaches multiple courses, so: InstructorId does not determines CourseNumber

Functional Dependency and Keys By definition, a primary key (candidate key) functionally determines all other attributes Primary key Surrogate key Composite primary key Dependency diagram ISBN Title PubDate ListPrice

Functional Dependency Exercise CustomerNum  CustomerName? {Street, City, State}  Zip? CustomerName  Balance? State (?) Zip RepNum ( ? ) CustomerName

Normalization – 2NF A relation is in 2NF, if Partial dependency A B C It is in 1st normal formal, and All nonkey attributes must be functionally dependent on the whole primary key (Full dependency) No partial dependency It implies that a relation is in 2NF if there is a single-attribute primary key (candidate key) Partial dependency A non-key attribute is dependent on part of a primary key A B C D

Transforming to 2NF A B C D A B C B D Identify primary key (PK) If PK consists of only one field, then it is in 2NF If PK is a composite key, then analyze functional dependency between part of primary key and other non-key attributes Move partial dependency involved attribute to another relation A B C D A B C B D

A Relation in 1NF but Not in 2NF Partial dependency

Transforming to 2NF: Example Order Order Product OrderItem

Problems in 2NF Again, redundancy and potential inconsistency

Normalization – 3NF A relation is in 3NF, if Transitive dependency It is in 2nd normal formal, and All attributes must, and only, be functionally dependent on candidate keys No transitive dependency Transitive dependency A  B and B  C, then A  C A B C D

A Relation in 2NF but Not in 3NF Identify primary key (PK) and Look for transitive dependence Transitive dependency

Transforming to 3NF Move the attributes involved in transitive dependency to another relation Order Customer

Some Practical Tips If there are attributes of two different entities in one table, there are usually problems To identify the normalization level, determine the primary key first; then look for partial dependence and transitive dependence Generally relations in the 3rd normalization forms are considered to be well formed; going higher may introduce unnecessary structural complexity which is inefficient for data queries Very often tables can go for lower normal forms (de-normalization) depending on design requirements

Normalization Exercise 1-1 Which normal form is the above table in? 1NF 2NF 3NF UNF

Normalization Exercise 1-2 Which normal form is the above table (2nd one) in? 1NF 2NF 3NF UNF

Normalization Exercise 1-3 Which normal form is the above table (first one) in? 1NF 2NF 3NF UNF

Normalization Exercise 1-4 Final database design with 3 tables

Summary

Summary Key concepts Normalization Normal forms Functional dependency