Database Normalization Il-Han Yoo CS 157A Professor: Sin-Min Lee.

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 By Jason Park Fall 2005 CS157A. Database Normalization Database normalization is the process of removing redundant data from your tables.
Shantanu Narang.  Background  Why and What of Normalization  Quick Overview of Lower Normal Forms  Higher Order Normal Forms.
Boyce-Codd NF Takahiko Saito Spring 2005 CS 157A.
Normalization Lite Pepper. Golden Rule Every attribute must depend upon the key, --- > 1NF the whole key, --- > 2NF and nothing but the key. -  3NF and.
Functional Dependency CS157a Sec. 2 Koichiro Hongo.
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.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 5 The Relational Model and Normalization.
Functional Dependency Presenter Usman Saeed. Definition Definition: –constraints on relations() –characteristic of an attribute where values are determined.
Normalization II. Boyce–Codd Normal Form (BCNF) Based on functional dependencies that take into account all candidate keys in a relation, however BCNF.
Chapter 14 Advanced Normalization Transparencies © Pearson Education Limited 1995, 2005.
Normalization Quiz Tao Li Grant Horntvedt. 1. Which of the following statements is true: a. Normal forms can be derived by inspecting the data in various.
Chapter 3 The Relational Model and Normalization
Normalization.
CS 405G: Introduction to Database Systems 16. Functional Dependency.
Normalization. Database Normalization Database normalization is the process of removing redundant data from your tables in to improve storage efficiency,
Cambridge TEC - Level 3 Certificate/Diploma IT. ICT Dept ScenarioLO1LO2LO3.
Copyright, Harris Corporation & Ophir Frieder, Normal Forms “Why be normal?” - Author unknown Normal.
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.
Chapter 13 Further Normalization II: Higher Normal Forms.
NormalizationNormalization Chapter 4. Purpose of Normalization Normalization  A technique for producing a set of relations with desirable properties,
Module Title? DBMS Normalization. Module Title? DBMS Normalization  Normalization is the process of removing redundant data from tables in order to improve.
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.
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Normalization Copyright © 1999 Patrick McDermott College of Alameda
In this chapter, you learn about the following: ❑ Anomalies ❑ Dependency and determinants ❑ Normalization ❑ A layman’s method of understanding normalization.
MS Access: Creating Relational Databases Instructor: Vicki Weidler Assistant: Joaquin Obieta.
IMS 4212: Normalization 1 Dr. Lawrence West, Management Dept., University of Central Florida Normalization—Topics Functional Dependency.
Normal Forms through BCNF CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Further Normalization I
1 5 Normalization. 2 5 Database Design Give some body of data to be represented in a database, how do we decide on a suitable logical structure for that.
By Abdul Rashid Ahmad. E.F. Codd proposed three normal forms: The first, second, and third normal forms 1NF, 2NF and 3NF are based on the functional dependencies.
CSE314 Database Systems Basics of Functional Dependencies and Normalization for Relational Databases Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E.
Lecture No 14 Functional Dependencies & Normalization ( III ) Mar 04 th 2011 Database Systems.
Component 4/Unit 6d Topic IV: Design a simple relational database using data modeling and normalization Description and Information Gathering Data Model.
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.
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.
CS 405G: Introduction to Database Systems
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.
Normalisation RELATIONAL DATABASES.  Last week we looked at elements of designing a database and the generation of an ERD  As part of the design and.
CS 405G: Introduction to Database Systems Database Normalization.
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.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 5 The Relational Model and Normalization.
IMS 4212: Normalization 1 Dr. Lawrence West, Management Dept., University of Central Florida Normalization—Topics Functional Dependency.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
Logical Database Design and Relational Data Model Muhammad Nasir
MS Access. Most A2 projects use MS Access Has sufficient depth to support a significant project. Relational Databases. Fairly easy to develop a good user.
1 CS490 Database Management Systems. 2 CS490 Database 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.
Normalization Karolina muszyńska
A brief summary of database normalization
Chapter 8: Relational Database Design
Normalization By Jason Park Fall 2005 CS157A.
Normalization.
Copyright © 2018, 2015, 20 Pearson Education, Inc. All Rights Reserved Database Concepts Eighth Edition Chapter # 2 The Relational Model.
Normalization By Jason Park Fall 2005 CS157A.
Database.
Presentation transcript:

Database Normalization Il-Han Yoo CS 157A Professor: Sin-Min Lee

 Database normalization relates to the level of redundancy in a relational database’s structure.  The key idea is to reduce the chance of having multiple different version of the same data.  Well-normalized databases have a schema that reflects the true dependencies between tracked quantities.  Any increase in normalization generally involves splitting existing tables into multiple ones, which must be re-joined each time a query is issued. Database Normalization

Normal Forms Edgar F. Codd originally established three normal forms: 1NF, 2NF and 3NF. Edgar F. Codd originally established three normal forms: 1NF, 2NF and 3NF. 3NF is widely considered to be sufficient. 3NF is widely considered to be sufficient. Normalizing beyond 3NF can be tricky with current SQL technology as of 2005 Normalizing beyond 3NF can be tricky with current SQL technology as of 2005 Full normalization is considered a good exercise to help discover all potential internal database consistency problems. Full normalization is considered a good exercise to help discover all potential internal database consistency problems.

First Normal Form ( 1NF ) “What is your favorite color?” “What food will you not eat?” TABLE 1 Person / Favorite Color Bob / blue Jane / green TABLE 2 Person / Foods Not Eaten Bob / okra Bob / brussel sprouts Jane / peas

Second normal Form ( 2NF ) 2NF prescribes full functional dependency on the primary key. 2NF prescribes full functional dependency on the primary key. It most commonly applies to tables that have composite primary keys, where two or more attributes comprise the primary key. It most commonly applies to tables that have composite primary keys, where two or more attributes comprise the primary key. It requires that there are no non-trivial functional dependencies of a non-key attribute on a part (subset) of a candidate key. A table is said to be in the 2NF if and only if it is in the 1NF and every non- key attribute is irreducibly dependent on the primary key It requires that there are no non-trivial functional dependencies of a non-key attribute on a part (subset) of a candidate key. A table is said to be in the 2NF if and only if it is in the 1NF and every non- key attribute is irreducibly dependent on the primary key

2NF Example PART_NUMBER (PRIMARY KEY) SUPPLIER_NAME (PRIMARY KEY) PRICE SUPPLIER_ADDRESS The PART_NUMBER and SUPPLIER_NAME form the composite primary key. SUPPLIER_ADDRESS is only dependent on the SUPPLIER_NAME, and therefore this table breaks 2NF.

SUPPLIER_NAME (PRIMARY KEY) SUPPLIER_ADDRESS 2NF Example (Con’t) In order to find if a table is in 2NF, ask whether any of the non-key attributes of the table could be derived from a subset of the composite key, rather than the whole composite key. If the answer is yes, it's not in 2NF. This is solved sometimes by using a correlation file, such as the supplier table above.

Third normal form 3NF requires that there are no non-trivial functional dependencies of non-key attributes on something other than a superset of a candidate key. A table is in 3NF if none of the non-primary key attributes is a fact about any other non-primary key attribute. In summary, all non-key attributes are mutually independent.

3NF Example PART_NUMBER (PRIMARY KEY) MANUFACTURER_NAME MANUFACTURER_ADDRESS MANUFACTURER_NAME (PRIMARY KEY) MANUFACTURER_ADDRESS PART_NUMBER (PRIMARY KEY) MANUFACTURER_NAME

Example Problems ? 1.Not very efficient with storage 2.This design does not protect data integrity 3.This table does not scale well

First Normal Form

Defining Relationships One to One One to Many Many to Many

Second Normal Form

Third Normal Form This new table violate Second Normal Form as the street and city will be verically redundant. Province will need to be in its own table which the city table will refer to as a foreign key.

Boyce-Codd normal form (BCNF) BCNF requires that there are no non-trivial functional dependencies of attributes on something other than a superset of a candidate key (called a superkey). All attributes are dependent on a key, a whole key and nothing but a key (excluding trivial dependencies, like A->A).

A table is said to be in the BCNF if and only if it is in the 3NF and every non-trivial, left- irreducible functional dependency has a candidate key as its determinant. In more informal terms, a table is in BCNF if it is in 3NF and the only determinants are the candidate keys.

Fourth normal form (4NF) 4NF requires that there are no non-trivial multi-valued dependencies of attribute sets on something else than a superset of a candidate key (called a superkey). 4NF requires that there are no non-trivial multi-valued dependencies of attribute sets on something else than a superset of a candidate key (called a superkey). A table is said to be in 4NF if and only if it is in the BCNF and multi-valued dependencies are functional dependencies. A table is said to be in 4NF if and only if it is in the BCNF and multi-valued dependencies are functional dependencies.

4NF Example EMPLOYEE_IDQUALIFICATION_IDTRAINING_COURSE_ID employee_qualification table: EMPLOYEE_ID QUALIFICATION_ID employee_training_course table: EMPLOYEE_ID TRAINING_COURSE_ID

EMPLOYEE_IDDEGREE_IDUNIVERSITY_ID 4NF Expample (con’t) This would require no changes to fit the fourth normal form requirements.

Fifth normal form (5NF and also PJ/NF) 5NF requires that there are no non-trivial join dependencies that not follow from the key constraints. 5NF requires that there are no non-trivial join dependencies that not follow from the key constraints. A table is said to be in the 5NF if and only if it is in 4NF and every join dependency in it is implied by the candidate keys. A table is said to be in the 5NF if and only if it is in 4NF and every join dependency in it is implied by the candidate keys.

Domain/key normal form(DKNF) DKNF requires that each key uniquely identifies each row in a table. DKNF requires that each key uniquely identifies each row in a table. A domain is the set of permissible values for an attribute. A domain is the set of permissible values for an attribute. By enforcing key and domain restrictions, the database is assured of being freed from modification anomalies. By enforcing key and domain restrictions, the database is assured of being freed from modification anomalies.

While sometimes called the 6NF, the DKNF should not be considered together with the seven other normal forms (1–6 and Boyce-Codd), because contrary to them it is not always achievable; furthermore, tables in the real 6NF are not always in the DKNF. While sometimes called the 6NF, the DKNF should not be considered together with the seven other normal forms (1–6 and Boyce-Codd), because contrary to them it is not always achievable; furthermore, tables in the real 6NF are not always in the DKNF.

Sixth normal form(6NF) This normal form was, as of 2005, only recently conjectured: the sixth normal form (6NF) was only defined when extending the relational model to take into account the temporal dimension (ie. time). This normal form was, as of 2005, only recently conjectured: the sixth normal form (6NF) was only defined when extending the relational model to take into account the temporal dimension (ie. time). Unfortunately, most current SQL technologies as of 2005 do not take into account this work, and most temporal extensions to SQL are not relational. Unfortunately, most current SQL technologies as of 2005 do not take into account this work, and most temporal extensions to SQL are not relational.