Multivalued Dependencies & Fourth Normal Form

Slides:



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

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Shantanu Narang.  Background  Why and What of Normalization  Quick Overview of Lower Normal Forms  Higher Order Normal Forms.
4NF and 5NF Prof. Sin-Min Lee Department of Computer Science.
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.
Multivalued Dependency Prof. Sin-Min Lee Department of Computer Science.
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.
Multivalued Dependency Prof. Sin-Min Lee Department of Computer Science.
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.
Fall 2001Arthur Keller – CS 1804–1 Schedule Today Oct. 4 (TH) Functional Dependencies and Normalization. u Read Sections Project Part 1 due. Oct.
Normalization II. Boyce–Codd Normal Form (BCNF) Based on functional dependencies that take into account all candidate keys in a relation, however BCNF.
Chapter 14 Advanced Normalization Transparencies © Pearson Education Limited 1995, 2005.
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.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
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.
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.
BCNF & Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
4NF (Multivalued Dependency), and 5NF (Join Dependency)
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
1 Multivalued Dependencies Fourth Normal Form Reasoning About FD’s + MVD’s.
1 Multivalued Dependencies Fourth Normal Form Reasoning About FD’s + MVD’s.
3 Spring Chapter Normalization of Database Tables.
Multivalued Dependencies Fourth Normal Form Tony Palladino 157B.
Ch 7: Normalization-Part 1
Final Review Zaki Malik November 20, Basic Operators Covered.
Design Theory for Relational Databases Functional Dependencies Decompositions Normal Forms: BCNF, Third Normal Form Introduction to Multivalued Dependencies.
4NF & MULTIVALUED DEPENDENCY By Kristina Miguel. Review  Superkey – a set of attributes which will uniquely identify each tuple in a relation  Candidate.
1 Database Design: DBS CB, 2 nd Edition Physical RDBMS Model: Schema Design and Normalization Ch. 3.
Advanced Normalization
Chapter 15 Relational Design Algorithms and Further Dependencies
Schedule Today: Next After that Normal Forms. Section 3.6.
Normalization DBMS.
Higher Forms of Normalization
Module 5: Overview of Database Design -- Normalization
CPSC-310 Database Systems
Relational Database Design by Dr. S. Sridhar, Ph. D
Schedule Today: Jan. 23 (wed) Week of Jan 28
Relational Database Design
Chapter 8: Relational Database Design
3.1 Functional Dependencies
Advanced Normalization
Normal forms First Normal Form (1NF) Second Normal Form (2NF)
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
11/12/2018.
Relational Design Theory
BCNF and Normalization
CPSC-310 Database Systems
Database Normalization
Module 5: Overview of Normalization
Functional Dependencies and Normalization
Multivalued Dependencies & Fourth Normal Form (4NF)
Mulitvalued Dependencies
Database solutions The process of normalization Marzena Nowakowska Faculty of Management and Computer Modelling Kielce University of Technology rooms:
Multivalued Dependencies & Fourth Normal Form
Normalization.
Relational Design Theory
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Decomposition and Higher Forms of Normalization
CS 405G: Introduction to Database Systems
Instructor: Mohamed Eltabakh
Functional Dependencies
Relational Database Design
Join Dependencies and Fifth Normal Form
Multivalued Dependencies
Anomalies Boyce-Codd Normal Form 3rd Normal Form
Chapter 7a: Overview of Database Design -- Normalization
CS4222 Principles of Database System
Presentation transcript:

Multivalued Dependencies & Fourth Normal Form

Functional Dependency S b Q c W Domain (X) Range (Y)

Functional Dependency Recall that if X uniquely determines Y, then Y is functionally dependent on X(X->Y) You may recall math the terms Domain and Range. The domain is the set of all values possible of X and the range is the set of all possible values of Y. The relation is a function because each of the elements of X maps exactly to one element of Y.

Multi valued Dependency (MVD) Smith Jones Cooper Anna John Lila Elsa Chris Employee (X) Dependent (Y)

Definition of MVD A multivalued dependency on R, X ->>Y, says that if two tuples of R agree on all the attributes of X, then their components in Y may be swapped, and the result will be two tuples that are also in the relation. i.e., for each value of X, the values of Y are independent of the values of R-X-Y. Multivalued dependency is also referred as a tuple-generating dependency. The multivalued dependency also plays a role in 4NF normalization.

Properties of MVD If α ->> β, Then α ->> R − β If α ->> β and δ  γ , Then αδ ->> βγ If α ->> β and If β ->> γ, then α ->> γ - β A decomposition of R into (X, Y) and (X, R-Y) is a lossless-join decomposition if and only if X ->> Y holds in R.

Decomposition Theorem The split of relations is guaranteed to be lossless if the intersection of the attributes of the new tables is a key of at least one of them. The join connects tuples depending on the attribute (values) in the intersection. If these values uniquely identify tuples in the other relation we do not lose information.

Example of lossy decomposition Original table A B C 1 2 A C 1 2 A B 1 2 A B C 1 2 Reconstruction

MVD Example namephones Name beersliked name addr phones beersLiked sue a p1 b1 sue a p2 b2 sue a p2 b1 sue a p1 b2

MVD Example Drinkers(name, addr, phones, beersLiked) A drinker’s phones are independent of the beers they like. namephones and namebeersLiked. Thus, each of a drinker’s phones appears with each of the beers they like in all combinations.

4NF Definition A relation R is in 4NF if and only if, for every one of its non-trivial multivalued dependencies XY, X is a superkey—that is, X is either a candidate key or a superset thereof. Nontrivial MVD means that: Y is not a subset of X, and X and Y are not, together, all the attributes.

Decomposition into 4NF If XY is a 4NF violation for relation R, we can decompose R using the same technique as for BCNF. XY is one of the decomposed relations. All but Y – X is the other.

4NF Decomposition Example Drinkers(name, addr, phones, beersLiked) FD: nameaddr MVD’s: namephones namebeersLiked Key is {name, phones, beersLiked}. All dependencies violate 4NF.

4NF Decomposition Example (cont.) Decompose using nameaddr: Drinkers1(name, addr) In 4NF; only dependency is nameaddr. Drinkers2(name, phones, beersLiked) Not in 4NF. MVD’s namephones and namebeersLiked apply. No FD’s, so all three attributes form the key.

4NF Decomposition Example (cont.) Decompose Drinkers2 Either MVD name ->-> phones or name ->-> beersLiked tells us to decompose to: Drinkers3(name, phones) Drinkers4(name, beersLiked)

An Example This relation has extraneous tuples Must be removed to be in 4NF StudentName Major Classes smith CS Null Math CS146 Math104 CS151 StudentName Major smith CS Math StudentName Classes Smith CS146 Smtih Math104 CS151 These are both now in fourth normal form

Checking for Multivalued Dependencies You must check for all like tuples For example: A->>B A B C 1 3 5 2 4 6 7 8 In this case you have to calculate for the tuples shown in each chart. A B C 1 3 5 7 A B C 2 4 6 8

Checking for Multivalued Dependencies, Cont. There is an easy way to check! First, write the tuples to be compared A B C 1 3 5 7

Checking for Multivalued Dependencies, Cont. Next, write the attributes in the multivalued dependency on the chart, underneath their current place in the same order A B C 1 3 5 7

Checking for Multivalued Dependencies, Cont. Next, write the extra attributes below the originals, but swap the order as shown A B C 1 3 5 7

Checking for Multivalued Dependencies, Cont. Then check relation to see if all the dependencies exist A B C 1 3 5 7 A B C 1 3 5 2 4 6 7 8 Not all exist, so this is not a proper multivalued dependency

Fifth Normal Form An entity is in Fifth Normal Form (5NF) if, and only if, it is in 4NF and every join dependency for the entity is a consequence of its candidate keys.   A relation decompose into two relations must have the lossless-join property, which ensures that no spurious tuples are generated when relations are reunited through a natural join operation.

Example

Decomposition Redundancy can be removed, Now join these relations, The row marked with the arrow is a spurious row.

Domain Key Normal Form A relation is in DK/NF if every constraint on the relation is a logical consequence of the definition of keys and domains.