Functional dependencies and normalization 1 Normalization Functional dependencies 1.-3. NF + BCNF.

Slides:



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

FEN Introduction to the database field: Quality checking table design: Design Guidelines Normalisation Seminar: Introduction to relational.
Functional Dependencies and Normalization for Relational Databases
Normalisation to 3NF Database Systems Lecture 11 Natasha Alechina.
Normalization continued CMSC 461 Michael Wilson. Normalization clarification  Normalization is simply a way of reducing anomalous database behavior 
Normalisation The theory of Relational Database Design.
Normalization of Database Tables
Design Guidelines Normalisation Table Design. Informal Design Guidelines Table Semantics A table should hold information about one and only one entity/concept.
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
Boyce-Codd Normal Form Kelvin Nishikawa SE157a-03 Fall 2006 Kelvin Nishikawa SE157a-03 Fall 2006.
Normalization of Database Tables
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 5 The Relational Model and Normalization.
Chapter 5 Normalization of Database Tables
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
Databases 6: Normalization
Why Normalization? To Reduce Redundancy to 1.avoid modification, insertion, deletion anomolies 2.save space Goal: One Fact in One Place.
July 14, 2015ICS 424: recap1 Relational Database Design: Recap of ICS 324.
NORMALIZATION N. HARIKA (CSC).
Chapter 3 The Relational Model and Normalization
Chapter 5 Normalization of Database Tables
DBSQL 4-1 Copyright © Genetic Computer School 2009 Chapter 4 Database Design.
Web-Enabled Decision Support Systems
Chapter 3: Relational Model I Structure of Relational Databases Structure of Relational Databases Convert a ER Design to a Relational Database Convert.
IT420: Database Management and Organization Normalization 31 January 2006 Adina Crăiniceanu
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.
Your name here. Improving Schemas and Normalization What are redundancies and anomalies? What are functional dependencies and how are they related to.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Lecture 5: Functional dependencies and normalization Jose M. Peña
Data Normalization Normal is not something to aspire to, it's something to get away from. ~ Jodie Foster ~
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.
FEN Quality checking table design: Design Guidelines Normalisation Table Design Is this OK?
Functional Dependencies and Normalization for Relational Databases.
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.
Database Principles: Fundamentals of Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables Carlos Coronel, Steven.
Normalization of Database Tables
©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.
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
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 MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
Database Systems, 8 th Edition Improving the Design Table structures cleaned up to eliminate initial partial and transitive dependencies Normalization.
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
The relational model1 The relational model Mathematical basis for relational databases.
FEN Introduction to the database field: The development process Seminar: Introduction to relational databases Development process: Analyse.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Normal Forms (Part 1) Steven Le ~ CS157B. Normalization is a systematic way of ensuring that a database structure is suitable for general-purpose querying.
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.
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.
COP 6726: New Directions in Database Systems
Translating ER into Relations; Normalization
Advanced Normalization
Normalization Karolina muszyńska
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Payroll Management System
Advanced Normalization
Sampath Jayarathna Cal Poly Pomona
Lecture 5: Functional dependencies and normalization
Presentation transcript:

Functional dependencies and normalization 1 Normalization Functional dependencies NF + BCNF

Functional dependencies and normalization 2 Terminology Functional dependency –Dependency between attributes in a single relation Normal form –Rule, which a relation must obey. Higher normal form means more “quality” in the relation. Normalization –Process that leads the relation to a certain normal form.

Functional dependencies and normalization 3 2 types of database-design Bottom-up Starting point: –A set of attributes –Dependencies among the attributes. Hard to survey all the attributes. Top-down Starting point: –Attributes “grouped” into relations from ER- diagram (analysis).

Functional dependencies and normalization 4 Normalization Can be used in 2 ways: –Quality check of relations (from ER) Top down Normal procedure –Process, starting with unordered data Bottom up Not recommended Used in many book (in the normalization chapters)

Functional dependencies and normalization 5 Goal of normalization Reduce redundancy –Redundant data: Data that occurs more than once (or can be inferred from other data) Price_incl_postage = price + postage Reduce the number of NULLs –NULLs fill the database without giving any information.

Functional dependencies and normalization 6 Keys Key –Minimal set of attributes that uniquely defines any row. –Primary key If the set of attributes consists of ONE attribute –Composite primary key If the set of attributes consists of more that one attribute. –Prime attribute Attribute in some candidate key Secondary key –If we have more than one key. One of the candidates is chosen as the primary key. Surrogate key (aka. ID) –Invented (not in the real world) attribute. –Advice: Always use surrogate keys. Never use real world data in a key Real world data might change in the future.

Functional dependencies and normalization 7 Functional dependency CPR → first name –1 CPR leads to exactly 1 first name CPR → phone number –Probably not true: Many people have more than 1 phone number Must be true in every relational state –in the past and in the future A relational state may –Exclude certain functional dependencies –Never show any functional dependencies

Functional dependencies and normalization 8 Dependency diagram A dependency of a relation –All attribute of the relation –The key (bold) –The dependencies (arrows)

Functional dependencies and normalization 9 1. normal form A relation is on 1NF, if –Primary key defined –All attributes are atomic Forbids –Multi valued attributes Create more tuples in the relation. Create a new relation with foreign keys to this relation –Composite attributes Create an attribute for each sub-attribute.

Functional dependencies and normalization normal form 1NF + no partial dependency Partial dependency –An attribute is dependent of a PART of the key. –Only interesting if the key is composite. Example –StudentCourse: studentID, courseID  grade courseID  courseName What to do? Divide the relation –Partial dependent attributes must have their own relation.

Functional dependencies and normalization normal form 2NF + no transitive dependency Transitive dependency –Person: CPR  post and code  city What to do? Divide the relation –Transitive dependencies must go into another relation

Functional dependencies and normalization 12 The Relational oath "I promise to use the key, the whole key, and nothing but the key, so help me Codd." Codd defined the relational model - and invented the normal forms [1970].

Functional dependencies and normalization 13 BCNF Boyce-Codd Normal form –Named after its inventors: Boyce and Codd –Stronger than 3NF, but less strong than 4NF A relation is in BCNF, if –For every functional dependency A → B –A must be a super key in the relation

Functional dependencies and normalization 14 BCNF “cut-through” Find all the functional dependencies Check that the left hand sides of the functional dependencies are (super)keys –If they are not, then split the relation into 2 sub- relations No need to go through 1NF, 2NF, and 3NF

Functional dependencies and normalization 15 Strengths of the normal forms

Functional dependencies and normalization 16 Denormalization Normalization produces many (good) tables. –Many joins: Takes extra time at “select” –Sometimes we prefer fewer tables with controlled redundancy.