Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.

Slides:



Advertisements
Similar presentations
Manipulating Functional Dependencies Zaki Malik September 30, 2008.
Advertisements

Chapter 3 Notes. 3.1 Functional Dependencies A functional dependency is a statement that – two tuples of a relation that agree on some particular set.
Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)
Properties of Armstrong’s Axioms Soundness All dependencies generated by the Axioms are correct Completeness Repeatedly applying these rules can generate.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 227 Database Systems I Design Theory for Relational Databases.
Normalization DB Tuning CS186 Final Review Session.
Normalization DB Tuning CS186 Final Review Session.
Multivalued Dependency Prepared by Tomasz Kaciak CS157A.
DATABASE DESIGN Functional Dependencies. Overview n Functional Dependencies n Normalization –Functional dependencies –Normal forms.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Cs3431 Normalization. cs3431 Why Normalization? To remove potential redundancy in design Redundancy causes several anomalies: insert, delete and update.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Databases 6: Normalization
Boyce-Codd NF & Lossless Decomposition Professor Sin-Min Lee.
Functional Dependencies CS 186, Spring 2006, Lecture 21 R&G Chapter 19 Science is the knowledge of consequences, and dependence of one fact upon another.
Chapter 14 Advanced Normalization Transparencies © Pearson Education Limited 1995, 2005.
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
CS 405G: Introduction to Database Systems 16. Functional Dependency.
FUNCTIONAL DEPENDENCIES. Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant Information.
Computing & Information Sciences Kansas State University Monday, 13 Oct 2008CIS 560: Database System Concepts Lecture 18 of 42 Monday, 13 October 2008.
Introduction to Normalization CPSC 356 Database Ellen Walker Hiram College.
Normal Forms1. 2 The Problems of Redundancy Redundancy is at the root of several problems associated with relational schemas: Wastes storage Causes problems.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Your name here. Improving Schemas and Normalization What are redundancies and anomalies? What are functional dependencies and how are they related to.
Design Theory for Relational Databases 2015, Fall Pusan National University Ki-Joune Li.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Functional Dependencies An example: loan-info= Observe: tuples with the same value for lno will always have the same value for amt We write: lno  amt.
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Logical Database Design (1 of 3) John Ortiz Lecture 6Logical Database Design (1)2 Introduction  The logical design is a process of refining DB schema.
1 Lecture 6: Schema refinement: Functional dependencies
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
Christoph F. Eick: Functional Dependencies, BCNF, and Normalization 1 Functional Dependencies, BCNF and Normalization.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
1 Functional Dependencies. 2 Motivation v E/R  Relational translation problems : –Often discover more “detailed” constraints after translation (upcoming.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 15.
Functional Dependencies R&G Chapter 19 Science is the knowledge of consequences, and dependence of one fact upon another. Thomas Hobbes ( )
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Multivalued Dependencies Fourth Normal Form Tony Palladino 157B.
Functional Dependencies CIS 4301 Lecture Notes Lecture 8 - 2/7/2006.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
CS 222 Database Management System Spring Lecture 4 Database Design Theory Korra Sathya Babu Department of Computer Science NIT Rourkela.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
CS542 1 Schema Refinement Chapter 19 (part 1) Functional Dependencies.
CS411 Database Systems Kazuhiro Minami 04: Relational Schema Design.
© D. Wong Functional Dependencies (FD)  Given: relation schema R(A1, …, An), and X and Y be subsets of (A1, … An). FD : X  Y means X functionally.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
11/06/97J-1 Principles of Relational Design Chapter 12.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Normalization and FUNctional Dependencies. Redundancy: root of several problems with relational schemas: –redundant storage, insert/delete/update anomalies.
Normal Forms Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems June 18, 2016 Some slide content courtesy of Susan Davidson.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Normalization Database Management Systems, 3rd ed., Ramakrishnan and Gehrke, Chapter 19.
Advanced Normalization
CS422 Principles of Database Systems Normalization
CS422 Principles of Database Systems Normalization
3.1 Functional Dependencies
Advanced Normalization
Functional Dependencies
Normalization cs3431.
Chapter 19 (part 1) Functional Dependencies
CSC 453 Database Systems Lecture
Chapter 3: Design theory for relational Databases
Presentation transcript:

Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.

 Given a set of attributes X, the closure X+ is the set of attributes functionally determined by X  Given a relation R and a set F of functional dependencies, we need a way to find whether a functional dependency X  Y is true with respect to F

 Given relation R with attributes A, B, C, D, E and A  BC, CD  E, BE  C  AE  _____?  From reflexivity, AE+ = { A, E }  From A  BC, AE+ = { A, B, C, E }  No other rules are applicable or add to AE+  We conclude that AE  ABCE or simply AE  BC  Or AE  A, AE  B, AE  C, and AE  E

 Given a set F of functional dependencies, the closure X+ of a set of attributes X is determined by the following algorithm:  Initialize X+ to X  Repeat until X+ does not change: ▪ Find any unapplied functional dependency Y  Z in F such that Y  X+ ▪ Set X+ = X+  Z

 A key K for a given relation R is a minimal set of attributes A 1, A 2,..., A n such that closure {A 1, A 2,..., A n }+ is the set of all attributes of R  MusicGroup(name, artist, genre, dateformed, datefirstjoined)  name  genre dateformed  name artist  datefirstjoined  K must be (name, artist) because K+ = {name, artist, genre, dateformed, datefirstjoined}

 Given a set F of functional dependencies, closure F+ is the set of all functional dependencies implied by F  F+ can be found using the set of inference rules (reflexivity, transitivity, augmentation, etc.)  Sets F 1 and F 2 of functional dependencies are considered equal if they have the same closure (i.e. F 1 + = F 2 +)

 In addition to determining closure F+ for set F of functional dependencies, we can also derive any functional dependency that follows from F via Armstrong’s axioms:  Reflexivity (if Y  X, then X  Y)  Augmentation (if X  Y, then XZ  YZ)  Transitivity (if X  Y and Y  Z, then X  Z)

 Given a set F of functional dependencies, any set of functional dependencies that’s equivalent to F is called a basis  We limit the possibilities by requiring that each dependency has a single attribute on the right-hand side  How many bases are there for a relation R with n functional dependencies in F?

 A minimal basis for a relation R is a basis B that satisfies the following conditions:  All functional dependencies in B have singleton right-hand sides  If any functional dependency is removed from B, the result is no longer a basis  If any left-hand side attribute is removed from a functional dependency of B, the result is no longer a basis

 Given basis B, we can determine whether it is a minimal basis via the algorithm below:  For each functional dependency X  Y in B, check if B – { X  Y } still implies X  Y ▪ if so, remove X  Y  For each functional dependency XW  Y in B, check if X+ is the same with respect to F and ( F – { XW  Y } )  { X  Y } ▪ if so, replace XW  Y with X  Y

 Given relation R( A, B, C, D ) and functional dependencies AB  C, C  D, and D  A  What are the keys of R?  What are the superkeys of R that are not keys?  Is the given set of functional dependencies a basis? Is it a minimal basis?

 What’s wrong with the relation below?  MusicGroup( name, artist, genre, dateformed, datefirstjoined )  i.e. how can tuples become corrupted or incorrect?

 Without normalization, problems with relations include:  Unnecessary redundancy  Insert anomalies  Update anomalies  Delete anomalies

 Splitting a relation into two (more specific) relations is called decomposition  The objective is to have each resulting relation be atomic  i.e. each relation should contain only information related to the key

 A given relation R with set F of functional dependencies is in BCNF if and only if all functional dependencies X  Y in F are:  either trivial (i.e. Y  X)  or X is a superkey of R  If relation R is not in BCNF, it is possible to use decomposition to transform R to BCNF

 Given a set F of functional dependencies for relation R( A 1, A 2,..., A n ) that is not in BCNF:  Convert F to a minimal basis  Find an X  Y that violates BCNF  Compute closure X+  Decompose R into: ▪ R 1 containing all attributes of X+ ▪ R 2 containing { A 1, A 2,..., A n } – ( X+ – X )  Project functional dependencies onto R 1 and R 2 Repeat!

 Given relation R( A, B, C, D, E ) and functional dependencies AB  AC, CE  D, B  A, and D  AE  What are the keys of R?  What are the superkeys of R that are not keys?  Is the given set of functional dependencies a basis? Is it a minimal basis?  Is relation R in BCNF? If not, decompose R such that it is in BCNF