Multivalued Dependencies. Intuition Redundancy: addresses, title repeated several times –because a star might have several addresses and stars in several.

Slides:



Advertisements
Similar presentations
Higher Normal Forms By John Nicosia CS 157a Fall 2007.
Advertisements

Functional Dependencies (FDs)
Lecture 21 CS 157 B Revision of Midterm3 Prof. Sin-Min Lee.
Spring 2011 Instructor: Hassan Khosravi
METU Department of Computer Eng Ceng 302 Introduction to DBMS Further Dependencies by Pinar Senkul resources: mostly froom Elmasri, Navathe and other books.
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.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 6 A First Course in Database Systems.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 227 Database Systems I Design Theory for Relational Databases.
4NF. PTypes Planes HasType Employees MServices Auth. MWorks Assignment AppliedOn States Dates PTypes(model, capacity,…) Planes(regno, model) Employees(sin,…)
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 8 A First Course in Database Systems.
Multivalued Dependency Prof. Sin-Min Lee Department of Computer Science.
Classroom Exercise: Normalization
1 Multi-valued Dependencies Salman Azhar Multi-valued Dependencies Fourth Normal Form These slides use some figures, definitions, and explanations from.
1 Multivalued Dependencies Fourth Normal Form Source: Slides by Jeffrey Ullman.
1 Multivalued Dependencies Fourth Normal Form. 2 Definition of MVD uA multivalued dependency (MVD) on R, X ->->Y, says that if two tuples of R agree on.
Closure The closure of {B 1 …B k } under the set of FDs S, denoted by {B 1 …B k } +, is defined as follows: {B 1 …B k } + = {B | any relation satisfies.
1 Multivalued Dependencies Fourth Normal Form Sources: Slides by Jeffrey Ullman book by Ramakrishnan & Gehrke.
Functional Dependencies Definition: If two tuples agree on the attributes A, A, … A 12n then they must also agree on the attributes B, B, … B 12m Formally:
CMSC424: Database Design Instructor: Amol Deshpande
Nov 11, 2003Murali Mani Normalization B term 2004: lecture 7, 8, 9.
Multivalued Dependency Prof. Sin-Min Lee Department of Computer Science.
The principal problem that we encounter is redundancy, where a fact is repeated in more than one tuple. Most common cause: attempts to group into one relation.
Winter 2002Arthur Keller – CS 1804–1 Schedule Today: Jan. 15 (T) u Normal Forms, Multivalued Dependencies. u Read Sections Assignment 1 due. Jan.
1 Multivalued Dependencies Fourth Normal Form. 2 A New Form of Redundancy uMultivalued dependencies (MVD’s) express a condition among tuples of a relation.
Multivalued Dependencies by Asmerom Tekeste. Normal Forms 1NF 2NF 3NF BCNF 4NF 5NF Functional dependencies Multivalued dependencies Join dependencies.
Multivalued Dependencies By David Wortham. Problem Introduction Assume a relation R (from the book): (credit Ullman and Widom) Assume a relation R (from.
1 Multi-valued Dependencies. 2 Multivalued Dependencies There are database schemas in BCNF that do not seem to be sufficiently normalized. Consider a.
Fall 2001Arthur Keller – CS 1804–1 Schedule Today Oct. 4 (TH) Functional Dependencies and Normalization. u Read Sections Project Part 1 due. Oct.
Functional Dependencies and Relational Schema Design.
Ch 7: Normalization-Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Multi-valued Dependencies and Fourth Normal Form
Normalization Goal = BCNF = Boyce-Codd Normal Form = all FD’s follow from the fact “key  everything.” Formally, R is in BCNF if for every nontrivial FD.
Copyright © Curt Hill Schema Refinement III 4 th NF and 5 th NF.
CS143 Review: Normalization Theory Q: Is it a good table design? We can start with an ER diagram or with a large relation that contain a sample of the.
Lecture 09: Functional Dependencies. Outline Functional dependencies (3.4) Rules about FDs (3.5) Design of a Relational schema (3.6)
SCUJ. Holliday - coen 1784–1 Schedule Today: u Normal Forms. u Section 3.6. Next u Relational Algebra. Read chapter 5 to page 199 After that u SQL Queries.
THIRD NORMAL FORM (3NF) A relation R is in BCNF if whenever a FD XA holds in R, one of the following statements is true: XA is a trivial FD, or X is.
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
1 Lecture 7: Normal Forms, Relational Algebra Monday, 10/15/2001.
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
Third Normal Form (3NF) Zaki Malik October 23, 2008.
Design Process - Where are we?
© D. Wong Normalization  Purpose: process to eliminate redundancy in relations due to functional or multi-valued dependencies.  Decompose relation.
Normalization.
Functional Dependencies and Relational Schema Design.
1 Multivalued Dependencies Fourth Normal Form Reasoning About FD’s + MVD’s.
1 Multivalued Dependencies Fourth Normal Form Reasoning About FD’s + MVD’s.
Design Theory for RDB Normal Forms. Lu Chaojun, SJTU 2 Redundant because these info may be figured out by using FD s1  … What’s Bad Design? Redundancy.
3 Spring Chapter Normalization of Database Tables.
Multivalued Dependencies Fourth Normal Form Tony Palladino 157B.
Dr Gordon Russell, Napier University Normalisation 2 - V2.0 1 Normalisation 2 Unit 3.2.
Multivalued Dependencies and 4th NF CIS 4301 Lecture Notes Lecture /21/2006.
Lecture 17 4 th Normal Form Prof. Sin-Min Lee Department of Computer Science.
© 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.
Final Review Zaki Malik November 20, Basic Operators Covered.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts.
4NF & MULTIVALUED DEPENDENCY By Kristina Miguel. Review  Superkey – a set of attributes which will uniquely identify each tuple in a relation  Candidate.
More on Decompositions and Third Normal Form CIS 4301 Lecture Notes Lecture /16/2006.
Formal definition of a key A key is a set of attributes A 1,..., A n such that for any other attribute B: A 1,..., A n  B A minimal key is a set of attributes.
Schedule Today: Jan. 23 (wed) Week of Jan 28
3.1 Functional Dependencies
Normalization Refine data To attain a good DB design
Problems in Designing Schema
Relational Design Theory
Multivalued Dependencies & Fourth Normal Form (4NF)
Mulitvalued Dependencies
Relational Design Theory
Multivalued Dependencies
Chapter 3: Multivalued Dependencies
Presentation transcript:

Multivalued Dependencies

Intuition Redundancy: addresses, title repeated several times –because a star might have several addresses and stars in several movies –yet, the relation is in BCNF (no nontrivial functional dependency) Reason: address and name are independent on each other namestreetcitytitleyear C. Fisher123 Map St.HollywoodStar Wars1977 C. Fisher5 Locust Ln.MalibuStar Wars1977 C. Fisher123 Map St.HollywoodEmpire Strikes Back1980 C. Fisher5 Locust Ln.MalibuEmpire Strikes Back1980 C. Fisher123 Map St.HollywoodReturn of the Jedi1983 C. Fisher5 Locust Ln.MalibuReturn of the Jedi1983 An instance of the Stars_in relation with address (street, city)

Intuition namestreetcitytitleyear C. Fisher123 Map St.HollywoodStar Wars1977 C. Fisher5 Locust Ln.MalibuEmpire Strikes Back1980 Can we reduce Stars_in to the following relation? What are the addresses of C. Fisher when he stars in Star Wars? How to avoid redundancy, yet still get the correct answer? namestreetcity C. Fisher123 Map St.Hollywood C. Fisher5 Locust Ln.Malibu nametitleyear C. FisherStar Wars1977 C. FisherEmpire Strikes Back1980 DECOMPOSITION WHAT IS THE GROUND FOR THIS DECOMPOSITION?

Multivalued Dependencies (MVD) A multivalued dependency is a statement about the fact that a set of attributes is independent from another set of attributes. Notation: A 1 A 2 …A n   B 1 B 2 …B m Meaning: for each pair of tuples t and u of R that agree on the A’s, we can find in R some tuple v that agrees: 1.With both t and u on the A’s 2.With t on the B’s 3.With u on the attributes that are not A’s or B’s

Illustration If A 1 A 2 …A n   B 1 B 2 …B m then for each pair t and u that agree on A’s we will find v such that v agrees with 1.t and u on A’s (green) 2.t on B’s(blue) 3.u on all others (red) A’s B’s t  u  MVD in picture Others v 

Example namestreetcitytitleyear C. Fisher123 Map St.HollywoodStar Wars1977 C. Fisher5 Locust Ln.MalibuEmpire Strikes Back1980 name   street city is a MVD of ‘Stars_in’ with address (street, city) (the A’s: name, the B’s {street, city}, others {title, year}) t  u  Because of t and u, the relation needs to contain the following tuple C. Fisher123 Map St.HollywoodEmpire Strikes Back1980 v  Switch t and u, we can conclude that the relation also needs to contain the following tuple: C. Fisher5 Locust Ln.MalibuStar Wars1977 v’  We can then reconstruct the first relation!

Nontrivial MVD A MVD of relation R A 1 …A n   B 1 …B m is nontrivial if –None of the B’s is among the A’s –Not all attributes of R belong to {A 1,…,A n }  {B 1,…,B m }

Reasoning about MVD Trivial dependencies rule: –if A 1 …A n   B 1 …B m then A 1 …A n   C 1 …C k where the C’s are the B’s plus some of the A’s –if A 1 …A n   B 1 …B m then A 1 …A n   D 1 …D r where the D’s are those B’s that are not among the A’s Transitive rule: if A 1 …A n   B 1 …B m and B 1 …B m   C 1 …C k then A 1 …A n   D 1 …D l where {D 1,…,D l } = {C 1,…,C k } \ {B 1,…,B m }

Reasoning about MVD If A 1 …A n  B 1 …B m then A 1 …A n   B 1 …B m If A 1 …A n   B 1 …B m then A 1 …A n   C 1 …C k where the C’s are all other attributes other than A’s and B’s (Complementation rule) NOTE: splitting/combining rules do not hold.

Fourth Normal Form (4NF) A relation R is in fourth normal form (4NF) if whenever there is a nontrivial MVD A 1 …A n   B 1 …B m, then {A 1,…,A n } is a superkey.

Decomposition into 4NF If R is not in 4NF then there exists a MVD A 1 …A n   B 1 …B m that violates the 4NF condition, we decompose R into 2 relations with the following schemas: –{A 1,…,A n,B 1,…,B m } –{A 1,…,A n,C 1,…,C k } where {C 1,…,C k } are those attributes of R that are not among the A’s and the B’s.

Example namestreetcitytitleyear C. Fisher123 Map St.HollywoodStar Wars1977 C. Fisher5 Locust Ln.MalibuEmpire Strikes Back1980 namestreetcity C. Fisher123 Map St.Hollywood C. Fisher5 Locust Ln.Malibu nametitleyear C. FisherStar Wars1977 C. FisherEmpire Strikes Back1980 DECOMPOSITION WHAT IS THE GROUND FOR THIS DECOMPOSITION? ANSWER: Because the MVD name   street city

Relationship among Normal Forms 4NF  BCNF  3NF Properties of NF and their decomposition Property3NF4NFBCNF Eliminates redundancy due to FD’sMostYes Eliminates redundancy due to MVD’sNoYesNo Preserves FD’sYesMaybe Preserves MVD’sMaybe

Homework 4 (Due Oct. 8) For each of the following relation schemas and sets of FDs: a. R(A,B,C,D) with FDs AB  C, C  D, D  A b. R(A,B,C,D) with FDs B  C, B  D c. R(A,B,C,D) with FDs AB  C, BC  D, CD  A, AD  B do the following: i.Indicate all the BCNF violations. Decompose the relations, as necessary, into collections of BCNF relations. (10pt) ii.Indicate all the 3NF violations. Decompose the relations, as necessary, into collections of 3NF relations. (10pt)

Homework 4 (Due Oct. 8) For each of the following relation schema and dependencies: a. R(A,B,C,D) with MVDs A  C, A  B b. R(A,B,C,D) with MVDs A  B, B  CD c. R(A,B,C,D) with MVDs AB  C and FD B  D do the following: i.Indicate all the 4NF violations. ii.Decompose the relations, as necessary, into collections of 4NF relations. (10pt)

Text for next class New edition (DBS the complete book): Chapter 4 Old edition (First course in DBS): –Section 2.1 –Section –Section 2.4.1, –Section –Section 3.2 (ALL)