NORMALIZATION N. HARIKA (CSC).

Slides:



Advertisements
Similar presentations
Normalization of Database Tables
Advertisements

Chapter 5 Normalization of Database Tables
Database Tables and Normalization
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
September 24, R McFadyen1 The objective of normalization is sometimes stated “to create relations where every dependency is on the primary.
DBS201: Introduction to Normalization
Normalization Normalization We discuss four normal forms: first, second, third, and Boyce-Codd normal forms 1NF, 2NF, 3NF, and BCNF Normalization.
1 Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Chapter 5 Normalization of Database Tables
Normalization of Database Tables Special adaptation for INFS-3200
Normalization of Database Tables
Need for Normalization
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Normalization of Database Tables
Normalization of Database Tables
Normalization of Database Tables
Database Systems: Design, Implementation, and Management Tenth Edition
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 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 5 Normalization of Database Tables
Lecture 12 Inst: Haya Sammaneh
Text & Original Presentations
ITEC 3220M Using and Designing Database Systems Instructor: Prof. Z. Yang Course Website: 3220m.htm
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Database Systems: Design, Implementation, and Management Tenth 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.
The Relational Model and Normalization R. Nakatsu.
1 DATABASE SYSTEMS DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT Chapter 7 Normalisation.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
Database Design – Lecture 8
Chapter 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management Peter Rob & Carlos Coronel.
Database Principles: Fundamentals of Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables Carlos Coronel, Steven.
Normalization of Database Tables
Chapter 4 Normalization of Database Tables. 2 Database Tables and Normalization Table is basic building block in database design Table is basic building.
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.
Review Database Application Development Access Database Development Theory Practice.
Database Systems, 8 th Edition Improving the Design Table structures cleaned up to eliminate initial partial and transitive dependencies Normalization.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Database Design Theory CS405G: Introduction to Database Systems Jinze Liu 3/15/20161.
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.
Chapter 5: Relational Database Design
Normalization (Chapter 2)
Normalization Karolina muszyńska
Chapter 4: Relational Database Design
Functional Dependencies
Normalization of Database Tables PRESENTED BY TANVEERA AKHTER FOR BCA 2ND YEAR dated:15/09/2015 DEPT. OF COMPUTER SCIENCE.
Normalization There is a sequence to normal forms:
Chapter 6 Normalization of Database Tables
Normalization Normalization
Normalization of Database Tables Uploaded by: mysoftbooks.ml
Normalization of DB relations examples Fall 2015
Sampath Jayarathna Cal Poly Pomona
DATABASE DESIGN & DEVELOPMENT
Database Design Theory CS405G: Introduction to Database Systems
Review of Week 3 Relation Transforming ERD into Relations
Database Normalization
Presentation transcript:

NORMALIZATION N. HARIKA (CSC)

NORMALIZATION Normalization We discuss four normal forms: first, second, third, and Boyce- Codd , fourth normal forms 1NF, 2NF, 3NF, BCNF and 4NF. Normalization is a process that “improves” a database design by generating relations that are of higher normal forms. The objective of normalization: “to create relations where every dependency is on the key, the whole key, and nothing but the key”. NORMALIZATION

NORMALIZATION There is a sequence to normal forms: 1NF is considered the weakest, 2NF is stronger than 1NF, 3NF is stronger than 2NF, and BCNF is considered the strongest, 4NF is considered the higher normal form. Also, any relation that is in 4NF, is in 3NF; any relation that is in BCNF, is in 3NF; any relation in 3NF is in 2NF; and any relation in 2NF is in 1NF. NORMALIZATION

NORMALIZATION Normalization 1NF a relation in 4NF, is also in 3NF a relation in BCNF, is also in 3NF a relation in 3NF is also in 2NF a relation in 2NF is also in 1NF 2NF 3NF BCNF 4NF NORMALIZATION 91.2914

NORMALIZATION We consider a relation in BCNF to be fully normalized. The benefit of higher normal forms is that update semantics for the affected data are simplified. This means that applications required to maintain the database are simpler. A design that has a lower normal form than another design has more redundancy. Uncontrolled redundancy can lead to data integrity problems. First we introduce the concept of functional dependency NORMALIZATION

NORMALIZATION Functional Dependencies Functional Dependencies We say an attribute, B, has a functional dependency on another attribute, A, if for any two records, which have the same value for A, then the values for B in these two records must be the same. We illustrate this as: A  B Example: Suppose we keep track of employee email addresses, and we only track one email address for each employee. Suppose each employee is identified by their unique employee number. We say there is a functional dependency of email address on employee number: employee number  email address NORMALIZATION

Functional Dependencies EmpNum EmpEmail EmpFname EmpLname 123 jdoe@abc.com John Doe 456 psmith@abc.com Peter Smith 555 alee1@abc.com Alan Lee 633 pdoe@abc.com 787 alee2@abc.com If EmpNum is the PK then the FDs: EmpNum  EmpEmail EmpNum  EmpFname EmpNum  EmpLname must exist. NORMALIZATION

Functional Dependencies EmpNum  EmpEmail EmpNum  EmpFname EmpNum  EmpLname 3 different ways you might see FDs depicted EmpEmail EmpNum EmpFname EmpLname EmpNum EmpEmail EmpFname EmpLname NORMALIZATION

Determinant NORMALIZATION Functional Dependency EmpNum  EmpEmail Attribute on the LHS is known as the determinant EmpNum is a determinant of EmpEmail NORMALIZATION

Partial dependency NORMALIZATION A partial dependency exists when an attribute B is functionally dependent on an attribute A, and A is a component of a multipart candidate key. InvNum LineNum Qty InvDate Candidate keys: {InvNum, LineNum} InvDate is partially dependent on {InvNum, LineNum} as InvNum is a determinant of InvDate and InvNum is part of a candidate key NORMALIZATION

Transitive dependency Consider attributes A, B, and C, and where A  B and B  C. Functional dependencies are transitive, which means that we also have the functional dependency A  C We say that C is transitively dependent on A through B. NORMALIZATION

Transitive dependency EmpNum  DeptNum EmpNum EmpEmail DeptNum DeptNname DeptNum  DeptName EmpNum EmpEmail DeptNum DeptNname DeptName is transitively dependent on EmpNum via DeptNum EmpNum  DeptName NORMALIZATION

The Need for Normalization

The Normalization Process Each table represents a single subject No data item will be unnecessarily stored in more than one table All attributes in a table are dependent on the primary key NORMALIZATION

Conversion to First Normal Form Repeating group Derives its name from the fact that a group of multiple entries of same type can exist for any single key attribute occurrence Relational table must not contain repeating groups Normalizing table structure will reduce data redundancies Normalization is three-step procedure Step 1: Eliminate the Repeating Groups Present data in tabular format, where each cell has single value and there are no repeating groups Eliminate repeating groups, eliminate nulls by making sure that each repeating group attribute contains an appropriate data value 15 NORMALIZATION

Conversion to First Normal Form (continued) NORMALIZATION

Conversion to First Normal Form (continued) Step 2: Identify the Primary Key Primary key must uniquely identify attribute value New key must be composed Step 3: Identify All Dependencies Dependencies can be depicted with help of a diagram Dependency diagram: Depicts all dependencies found within given table structure Helpful in getting bird’s-eye view of all relationships among table’s attributes Makes it less likely that will overlook an important dependency

Conversion to First Normal Form (continued)

Conversion to Second Normal Form Relational database design can be improved by converting the database into second normal form (2NF) Two steps Step 1: Write Each Key Component on a Separate Line Write each key component on separate line, then write original (composite) key on last line Each component will become key in new table Step 2: Assign Corresponding Dependent Attributes Determine those attributes that are dependent on other attributes At this point, most anomalies have been eliminated

Conversion to Second Normal Form (continued)

Conversion to Second Normal Form (continued) Table is in second normal form (2NF) when: It is in 1NF and It includes no partial dependencies: No attribute is dependent on only portion of primary key

Conversion to Third Normal Form Data anomalies created are easily eliminated by completing three steps Step 1: Identify Each New Determinant For every transitive dependency, write its determinant as PK for new table Determinant Any attribute whose value determines other values within a row Step 2: Identify the Dependent Attributes Identify attributes dependent on each determinant identified in Step 1 and identify dependency Name table to reflect its contents and function

Conversion to Third Normal Form (continued) Step 3: Remove the Dependent Attributes from Transitive Dependencies Eliminate all dependent attributes in transitive relationship(s) from each of the tables that have such a transitive relationship Draw new dependency diagram to show all tables defined in Steps 1–3 Check new tables as well as tables modified in Step 3 to make sure that each table has determinant and that no table contains inappropriate dependencies

Conversion to Third Normal Form (continued) A table is in third normal form (3NF) when both of the following are true: It is in 2NF It contains no transitive dependencies

The Boyce-Codd Normal Form (BCNF) Every determinant in table is a candidate key Has same characteristics as primary key, but for some reason, not chosen to be primary key When table contains only one candidate key, the 3NF and the BCNF are equivalent BCNF can be violated only when table contains more than one candidate key Most designers consider the BCNF as special case of 3NF Table is in 3NF when it is in 2NF and there are no transitive dependencies Table can be in 3NF and fails to meet BCNF No partial dependencies, nor does it contain transitive dependencies A nonkey attribute is the determinant of a key attribute

The Boyce-Codd Normal Form (BCNF) (continued)

Fourth Normal Form (4NF) Table is in fourth normal form (4NF) when both of the following are true: It is in 3NF Has no multiple sets of multivalued dependencies 4NF is largely academic if tables conform to following two rules: All attributes must be dependent on primary key, but independent of each other No row contains two or more multivalued facts about an entity

Fourth Normal Form (4NF) (continued)