Normalization Amit Bhawnani & Nimesh Shah. What is normalization We need some formal measure of why one grouping of attributes into a relational schema.

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

Normalization What is it?
Normalization Dr. Mario Guimaraes. Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints.
Normalisation The theory of Relational Database Design.
Ch 10, Functional Dependencies and Normal forms
4 TH NORMAL FORM & Lossless Decomposition By: Karen McVay CS 157B.
September 24, R McFadyen1 The objective of normalization is sometimes stated “to create relations where every dependency is on the primary.
The Relational Model System Development Life Cycle Normalisation
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
Chapter 8 Normal Forms Based on Functional Dependencies Deborah Costa Oct 18, 2007.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Functional Dependencies Definition: If two tuples agree on the attributes A, A, … A 12n then they must also agree on the attributes B, B, … B 12m Formally:
Boyce-Codd Normal Form Kelvin Nishikawa SE157a-03 Fall 2006 Kelvin Nishikawa SE157a-03 Fall 2006.
1 Database Design Theory Which tables to have in a database Normalization.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
Introduction to Schema Refinement
CS 405G: Introduction to Database Systems 16. Functional Dependency.
Week 6 Lecture Normalization
Copyright © Curt Hill Schema Refinement III 4 th NF and 5 th NF.
Copyright, Harris Corporation & Ophir Frieder, Normal Forms “Why be normal?” - Author unknown Normal.
IT420: Database Management and Organization Normalization 31 January 2006 Adina Crăiniceanu
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.
CS 405G: Introduction to Database Systems 18. Normal Forms and Normalization.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Database Design (Normalizations) DCO11310 Database Systems and Design By Rose Chang.
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.
Schema Refinement and Normal Forms 20131CS3754 Class Notes #7, John Shieh.
Chapter 7 1 Database Principles Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that.
Functional Dependencies and Normalization for Relational Databases.
Normalization Ioan Despi 2 The basic objective of logical modeling: to develop a “good” description of the data, its relationships and its constraints.
Further Normalization I
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
CSE314 Database Systems Basics of Functional Dependencies and Normalization for Relational Databases Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E.
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.
Relational Model & Normalization Relational terminology Anomalies and the need for normalization Normal forms Relation synthesis De-normalization.
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.
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
3 Spring Chapter Normalization of Database Tables.
CS 405G: Introduction to Database Systems Database Normalization.
Logical Database Design and the Relational Model.
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.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
Objectives of Normalization  To create a formal framework for analyzing relation schemas based on their keys and on the functional dependencies among.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
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.
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
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.
4NF & MULTIVALUED DEPENDENCY By Kristina Miguel. Review  Superkey – a set of attributes which will uniquely identify each tuple in a relation  Candidate.
Normalization Refine data To attain a good DB design
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
A SIMPLE GUIDE TO FIVE NORMAL FORMS (See the next slide for required reading) Prof. Ghandeharizadeh 2018/11/14.
Database Normalization
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Normalization Normalization theory is based on the observation that relations with certain properties are more effective in inserting, updating and deleting.
Chapter 14 Normalization.
Sampath Jayarathna Cal Poly Pomona
Lecture 5: Functional dependencies and normalization
Chapter 7a: Overview of Database Design -- Normalization
Presentation transcript:

Normalization Amit Bhawnani & Nimesh Shah

What is normalization We need some formal measure of why one grouping of attributes into a relational schema may be better than another Measure of “goodness” or quality of the design An analytical technique used during logical database design Offers a strategy for constructing relations and identifying keys

Normal Forms 1 NF 2 NF 3 NF 4 NF 5 NF Normal forms are INCREMENTAL

1 NF Eliminate repeating groups; attributes must have only atomic values Emp_idnamesalaryphone 101Abc , LMN XYZ , , Problems with the above design ? Employee

1 NF Soln 1: Emp_idphonenamesalary Abc Abc LMN XYZ XYZ XYZ78000 Problems with the above design ? Redundancy Insertion anomalies Deletion anomalies Updation anomalies

1 NF Soln 2: Emp_idnamesalaryphone1phone2phone3 101Abc LMN XYZ Problems with the above design ?

1 NF Soln 3: Emp_idnamesalary 101Abc LMN XYZ78000 Emp_idphone

Functional Dependency Require that the value for a certain set of attributes determines uniquely the value for another set of attributes. Functional dependencies define properties of the schema and not of any particular tuple in the relation. The functional dependency   

Functional Dependency Employee project details Emp_idProject_noEmp_namesalaryProject_name 1011ABC10000ProjA 1012ABC10000ProjB 1023LMN120000ProjC 1031XYZ78000ProjA 1032XYZ78000ProjB Emp_id -> {emp_name, salary} Project_no -> project_name Emp_id,project_no -> emp_name,salary,project_name Emp_name -> emp_id, project_name, salary, project name ???

2 NF Eliminate fields that are facts about only a subset of the key so that all non-key fields are fully functionally dependent on the primary key A relation is said to be in 2NF if and only if it is in 1 NF and every non-key attribute is fully functionally dependent on the primary key.

2 NF Employee project details Emp_idProject_noEmp_namesalaryProject_name 1011ABC10000ProjA 1012ABC10000ProjB 1023LMN120000ProjC 1031XYZ78000ProjA 1032XYZ78000ProjB Problems with the above design ? Redundancy Insertion anomalies Deletion anomalies Updation anomalies

2 NF Project_noProject_name 1ProjA 2ProjB 3ProjC Emp_idnamesalary 101Abc LMN XYZ78000 Emp_idProject_no Employee Project Employee_Project

3NF A relation should not have a non-key attribute functionally determine determined by another non-key attribute. Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key.

3 NF Emp_idEmp_namesalaryDept_idDept_nam e Deptmgr_empid 101Abc10000ADeptA 102LMN120000ADeptA XYZ78000BDeptB Emp_id -> {emp_name, salary, dept_id, dept_name, deptmr_empid} dept_id -> {dept_name, deptmgr_empid}

3 NF Dept_idDept_nameDeptmgr_empid ADeptA101 BDeptB103 Emp_idEmp_namesalaryDept_id 101Abc10000A 102LMN120000A 103XYZ78000B Employee Department

4 NF Eliminate all but one independent, multi-valued facts. If we have two or more multi valued independent attributes in the same relation schema we get into a problem of having to repeat every value of one of the attributes with every value of the other attribute to keep the relation state consistent and to maintain the independence among the attributes involved.

4 NF Emp_nameProject_nameDependent_name SmithXJohn SmithYAnna SmithXAnna SmithYJohn BrownWJim BrownXJim BrownYJim BrownZJim BrownWJoan BrownXJoan BrownYJoan BrownZJoan MVD (Multi valued dependency) Emp_name ->> project_name Emp_name ->> dependent_name

4 NF Emp_nameProject_name SmithX Y BrownW X Y Z Emp_nameDependent_name SmithAnna SmithJohn BrownW Jim BrownJoan BrownBob

5 NF Eliminate join dependencies A relation is said to be in 5 NF if and only if it is in 4 NF and every “join dependency” in the relation is implied by its key.

5 NF AgentManufacturerProduct MetroMarutiCar MetroMarutiVan AlphaM&MTruck AlphaM&MCar AlphaHondaCar AlphaHondaBike If an agent represents a company, and the company manufactures a product, then the agent will deal in that product.

5 NF AgentManufacturer MetroMaruti AlphaM&M AlphaHonda ManufacturerProduct MarutiCar MarutiVan M&MTruck M&MCar HondaBike HondaCar

Denormalization Process of attempting to optimize the read performance of a database by adding redundant data

Classroom exercise 1 Suppose you are given a relation R = (A,B,C,D,E) with the following functional dependencies: {CE -> D,D -> B,C -> A}. – Find all candidate keys. – Identify the best normal form that R satisfies (1NF, 2NF, 3NF)

Classroom exercise 1 Answer. – The only key is {C,E} – The relation is in 1NF

Classroom exercise 2 You are given the following set of functional dependencies for a relation R(A,B,C,D,E,F), F = {AB -> C,DC -> AE,E -> F}. – What are the keys of this relation? – Is this relation in 3NF? If not, explain why by showing one violation.

Classroom exercise 2 Answer – {A,B,D} and {B,C,D} – No, all functional dependencies are actually violating this. No dependency contains a superkey on its left side.