4NF (Multivalued Dependency), and 5NF (Join Dependency)

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.
Lecture 21 CS 157 B Revision of Midterm3 Prof. Sin-Min Lee.
Shantanu Narang.  Background  Why and What of Normalization  Quick Overview of Lower Normal Forms  Higher Order Normal Forms.
ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala N ATIONAL I NSTITUTE OF T ECHNOLOGY A GARTALA Aug-Dec,2010 Normalization 2 CSE-503 :: D ATABASE.
NORMALIZATION. Normalization Normalization: The process of decomposing unsatisfactory "bad" relations by breaking up their attributes into smaller relations.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Further Dependencies by Pinar Senkul resources: mostly froom Elmasri, Navathe and other books.
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.
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.
4NF. PTypes Planes HasType Employees MServices Auth. MWorks Assignment AppliedOn States Dates PTypes(model, capacity,…) Planes(regno, model) Employees(sin,…)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
Multivalued Dependency Prof. Sin-Min Lee Department of Computer Science.
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.
1 Multivalued Dependencies Fourth Normal Form Sources: Slides by Jeffrey Ullman book by Ramakrishnan & Gehrke.
Normal Form Design addendum by C. Zaniolo. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Normal Form Design Compute the canonical cover.
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.
Databases 6: Normalization
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.
Introduction to Schema Refinement
Ch 7: Normalization-Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
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.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Normalization for Relational Databases.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Further Normalization II: Higher Normal Forms Prof. Yin-Fu Huang CSIE, NYUST Chapter 13.
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.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide DESIGNING A SET OF RELATIONS (2) Goals: Lossless join property (a must). Dependency.
BCNF & Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
Normal Forms through BCNF CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Functional Dependencies and Normalization for Relational Databases
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 11 Relational Database Design Algorithms and Further Dependencies.
1 Functional Dependencies and Normalization Chapter 15.
IST 210 Normalization 2 Todd Bacastow IST 210. Normalization Methods Inspection Closure Functional dependencies are key.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Dr. Mohamed Osman Hegaz1 Logical data base design (2) Normalization.
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!
Normalization.
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.
Multivalued Dependencies and 4th NF CIS 4301 Lecture Notes Lecture /21/2006.
Ch 7: Normalization-Part 1
© 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.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Relational Database Design Algorithms and Further Dependencies.
Final Review Zaki Malik November 20, Basic Operators Covered.
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.
Design Theory for Relational Databases Functional Dependencies Decompositions Normal Forms: BCNF, Third Normal Form Introduction to Multivalued Dependencies.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
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.
Schedule Today: Jan. 23 (wed) Week of Jan 28
3.1 Functional Dependencies
CPSC-310 Database Systems
Multivalued Dependencies & Fourth Normal Form (4NF)
Mulitvalued Dependencies
Multivalued Dependencies & Fourth Normal Form
Multivalued Dependencies & Fourth Normal Form
Multivalued Dependencies
Presentation transcript:

4NF (Multivalued Dependency), and 5NF (Join Dependency)

Review Superkey – a set of attributes which will uniquely identify each tuple in a relation Candidate key – a minimal superkey Primary key – a chosen candidate key Secondary key – all the rest of candidate keys Prime attribute – an attribute that is a part of a candidate key (key column) Non-prime attribute – a non-key column Narotama University

Review (cont.) 1NF 2NF 3NF BCNF Eliminate repeating groups. Make a separate table for each set of related attributes, and give each table a primary key. 2NF Eliminate redundant data. Each attribute must be functionally dependent on the primary key. If an attribute depends on only part of a multi-valued key, remove it to a separate table. 3NF Eliminate columns not dependent on key. If attributes do not contribute to a description of the key, remove them to a separate table. Any transitive dependencies are moved into a smaller table. BCNF Every determinant in the table is a candidate key. If there are non-trivial dependencies between candidate key attributes, separate them out into distinct tables. All normal forms are additive, in that if a model is in 3NF, it is by definition also in 2NF and 1NF. Narotama University

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. Narotama University

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. Narotama University

Decomposition into 4NF Method Find a 4NF violation in R, say AB, where A is not a superkey. If there is such a 4NF violation, break the schema for the relation R that has the 4NF violation into two schemas. R1, whose schema is A’s and B’s. R2, whose schema is the A’s and all attributes of R that are not among the A’s or B’s. Find the FD’s and MVD’s that hold in R1 and R2. Recursively decompose R1 and R2 with respect to their projected dependencies. Narotama University

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. Narotama University

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. Narotama University

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

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. Narotama University

Tuples Implied by namephones MVD Example (cont.) Tuples Implied by namephones If we have tuples: Then these tuples must also be in the relation. name addr phones beersLiked sue a p1 b1 sue a p2 b2 sue a p2 b1 sue a p1 b2 Narotama University

Example Drinkers(name, addr, phones, beersLiked) with MVD Name  phones. If Drinkers has the two tuples: name addr phones beersLiked sue a p1 b1 sue a p2 b2 it must also have the same tuples with phones components swapped: sue a p2 b1 sue a p1 b2 Note: we must check this condition for all pairs of tuples that agree on name, not just one pair. Narotama University

Example (cont’d) Violates 4NF because CUSTOMER is not a superkey (and CUSTOMER->->LOAN_NO is non-trivial) Narotama University

Solution: Narotama University

HIGHER NORMAL FORMS 1NF 2NF 3NF BCNF 4NF 5NF functional dependencies multivalued dependencies join dependencies Narotama University

24-HOUR FLIGHT-TIMETABLE, ALL FLIGHTS EVERY DAY ASSUMPTIONS 24-HOUR FLIGHT-TIMETABLE, ALL FLIGHTS EVERY DAY ALL PLANES TAKE-OFF AND LAND (BUT DO NOT CRASH) NO AIRPORT IS LANDING-ONLY & NO AIRPORT IS TAKE-OFF-ONLY   TTAB (ORG) =  TTAB (DST) THERE IS AT LEAST ONE TIME DELAY ENTRY FOR EVERY FLIGHT SIMILARLY IN WEATHER REPORT HISTORY IF NO TWO FLIGHTS CAN TAKE OFF AT THE SAME TIME IN THE SAME AIRPORT WES CAN BE POSTED TO FLIGHT AND WEATHER@ORIGIN ELIMINATED Narotama University

teaches (UNIVERSITY, DISCIPLINE) is_read_for (DISCIPLINE, DEGREE) Old Town Computing BSc Mathematics PhD New City AWARD teaches (UNIVERSITY, DISCIPLINE) is_read_for (DISCIPLINE, DEGREE) awards (UNIVERSITY, DEGREE) teaches (NewCity, Computing) = true awards (NewCity, PhD) = true is_read_for (Computing, BSc) = true FROM (NewCity teaches Computing) and (Computing is_read_for BSc) IT DOES NOT FOLLOW NewCity awards BSc for_reading Computing Narotama University

Narotama University

Join Dependency JD * (R1, R2, R3, ..., Rm) holds in R iff R = join (R1, R2, R3, ..., Rm ), Ri - a projection of R Narotama University

Fifth Normal Form preventing illogical conjunction of facts R A relation R is in 5NF iff for all JD * (R1, R2, R3, ..., Rm) in R, every Ri is a superkey for R. JD* ( , ) holds for R then R is not in 5NF if does not contain key JD* ( , ) then R is in 5NF if Narotama University

AWARD UNIVERSITY DISCIPLINE Old Town Computing Mathematics New City DEGREE Computing BSc Mathematics PhD UNIVERSITY DEGREE Old Town BSc PhD New City Narotama University

candidate keys - NAME or CODE join dependencies JD1 * ((NAME, CODE, TEACHING), (NAME, RESEARCH)) JD2 * ((NAME, CODE, RESEARCH), (NAME, TEACHING)) JD3 * ((NAME, CODE, TEACHING), (CODE, RESEARCH)) JD4 * ((NAME, CODE, RESEARCH), (CODE, TEACHING)) JD5 * ((NAME, CODE), (NAME, TEACHING), (CODE,RESEARCH)) ............................................................................................. all projections in JD1 - to JD5 are superkeys for RANKING  5NF Narotama University

Summary A multivalued dependency is a statement that two sets of attributes in a relation have sets of values that appear in all possible combinations. If a relation is in 4NF, then every nontrivial MVD is really an FD with a superkey on the left. Narotama University

References http://www.cs.sjsu.edu/~lee/cs157b/Spring09Presentation/ 4NF_and_Multivalued_Dependency_by_Kristina_Miguel. ppt http://www.cs.sjsu.edu/faculty/lee/cs157/4NF%20and%205 NF.ppt Narotama University