More about Functional Dependencies and Normalization.

Slides:



Advertisements
Similar presentations
Chapter 5 Normalization of Database Tables
Advertisements

Boyce-Codd NF Takahiko Saito Spring 2005 CS 157A.
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.
September 24, R McFadyen1 The objective of normalization is sometimes stated “to create relations where every dependency is on the primary.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke’s Chapter Three: The Relational Model and Normalization.
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.
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.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 David M. Kroenke Database Processing Chapter 3 Normalization.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day4.
Chapter 5 Normalization of Database Tables
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
Why Normalization? To Reduce Redundancy to 1.avoid modification, insertion, deletion anomolies 2.save space Goal: One Fact in One Place.
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.
Functional Dependence An attribute A is functionally dependent on attribute(s) B if: given a value b for B there is one and only one corresponding value.
Copyright, Harris Corporation & Ophir Frieder, Normal Forms “Why be normal?” - Author unknown Normal.
Fundamentals, Design, and Implementation, 9/e. Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/2 Copyright.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 4 This material was developed by Oregon Health & Science.
Avoiding Database Anomalies
Database Systems: Design, Implementation, and Management Tenth Edition
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, Fifth Edition
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
1 A Guide to MySQL 2 Database Design Fundamentals.
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.
Database Design (Normalizations) DCO11310 Database Systems and Design By Rose Chang.
資料庫正規化 Database Normalization 取材自 AIS, 6 th edition By Gelinas et al.
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.
Chapter 7 1 Database Principles Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that.
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.
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.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Component 4/Unit 6d Topic IV: Design a simple relational database using data modeling and normalization Description and Information Gathering Data Model.
©NIIT Normalizing and Denormalizing Data Lesson 2B / Slide 1 of 18 Objectives In this section, you will learn to: Describe the Top-down and Bottom-up approach.
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.
Relational Model & Normalization Relational terminology Anomalies and the need for normalization Normal forms Relation synthesis De-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.
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 MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 What Makes Determinant Values Unique? A determinant is unique in.
Normalisation 1NF to 3NF Ashima Wadhwa. In This Lecture Normalisation to 3NF Data redundancy Functional dependencies Normal forms First, Second, and Third.
Lecture 4: Logical Database Design and the Relational Model 1.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
Normalization ACSC 425 Database Management Systems.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
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.
David M. Kroenke and David J. Auer Database Processing: F undamentals, Design, and Implementation Chapter Three: The Relational Model and Normalization.
5. The Relational Model and Normalization 5.1 Relational Model5.2 Normalization 5.3 1NF to 5NF 5.4 Domain/Key Normalization 5.5 Synthesis of Relation 5.6.
Database Normalization. What is Normalization Normalization allows us to organize data so that it: Normalization allows us to organize data so that it:
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.
Adapted from DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 Functional Dependencies and Normalization.
CSIS 115 Database Design and Applications for Business
Database Normalization
Database Processing: David M. Kroenke’s Chapter Three:
Sampath Jayarathna Cal Poly Pomona
Chapter 4 The Relational Model and Normalization
Presentation transcript:

More about Functional Dependencies and Normalization

Functional Dependencies A functional dependency occurs when the value of one (set of) attribute(s) determines the value of a second (set of) attribute(s) –X  Y if, and only if, whenever two rows agree on X, they must necessarily agree on Y The attribute on the left side of the functional dependency is called the determinant –SID  DormName, Fee –(CustomerNumber, ItemNumber, Quantity)  Price While a primary key is always a determinant, a determinant is not necessarily a primary key Functional dependencies are fundamental to database “normalization”

Functional Dependencies EmpName,SSN,BirthDate,Address,DeptNo,DeptName (This is not a well designed schema, as we will see…) While a primary key is always a determinant, a determinant is not necessarily a primary key. Here SSN is the primary key, and it is also true that within each row, DeptNo determines DeptName.

Normalization Normalization eliminates modification anomalies –Deletion anomaly: deletion of a row loses information about two or more entities –Insertion anomaly: insertion of a fact in one entity cannot be done until a fact about another entity is added Anomalies can be removed by splitting the relation into two or more relations; each with a different, single theme However, breaking up a relation may create referential integrity constraints Normalization works through classes of relations called normal forms

Relation schemas suffering from update anomalies: EmpName,SSN,BirthDate,Address,DeptNo,DeptName ProjectNo,SSN,Hours,EmpName,ProjName,ProjLocation Why so?

Normal Forms Any table of data is in 1NF if it meets the definition of a relation A relation is in 2NF if all its non-key attributes are dependent on all of the key (no partial dependencies) –If a relation has a single attribute key, it is automatically in 2NF A relation is in 3NF if it is in 2NF and has no transitive dependencies A relation is in BCNF if every determinant is a candidate key A relation is in 4NF if it is in BCNF and has no multi- value dependencies

2 nd Normal Form ProjectNo|SSN|Hours|EmpName|ProjName|ProjLocation Employee_Project relation ProjectNo|SSN|HoursSSN|EmpName ProjectNo|ProjName|ProjLocation So, in 2 nd Normal Form becomes 3 relations: EmployeeProject_Hours Project A relation is in 2NF if all its non-key attributes are dependent on all of the key.

Third Normal Form: EmpName,SSN,BirthDate,Address,DeptNo,DeptName A relation is in 3NF if it is in 2NF and has no transitive dependencies. So, in 3NF becomes two relations: EmpName,SSN,BirthDate,Address,DeptNo DeptNo,DeptName

Another BCNF example: Every determinant must be a candidate key StudentID | Course | Instructor Coursework relation in 3NF: Student | InstructorInstructor | Course In BCNF becomes 2 relations: Instructor-Course:Student-Course: Nora JonesDatabaseReynolds Willie NelsonPLCVanWie Willie NelsonOperating SystemsCarithers Jane ManheitDatabaseReynolds

A 4NF example: EmployeeName,ProjectName,DependentName Nora JonesSwingTimenone Willie Nelson OnTheRoad ProblemsWithIRS Sam Lisa Willie Nelson ProblemsWithIRS OnTheRoad Sam Lisa Jane Manheit Standards Linda Bill EmployeeName,DependentName EmployeeName,ProjectName In 4NF becomes 2 relations: Employee-Project: Employee-Dependent:

De-normalized Designs When a normalized design is unnatural, awkward, or results in unacceptable performance, a de- normalized design is preferred Example –Normalized relation CUSTOMER (CustNumber, CustName, Zip) CODES (Zip, City, State) –De-Normalized relations CUSTOMER (CustNumber, CustName, City, State, Zip)