5NF and other normal forms

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

Applications Computational LogicLecture 11 Michael Genesereth Spring 2004.
Copyright: ©2005 by Elsevier Inc. All rights reserved. 1 Author: Graeme C. Simsion and Graham C. Witt Chapter 3 The Entity-Relationship Approach.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Database Design: Normalization J.G. Zheng June 29 th 2005 DB Chapter 4.
Source of slides: Introduction to Automata Theory, Languages and Computation.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
0 - 0.
ALGEBRAIC EXPRESSIONS
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
Fourth normal form: 4NF 1. 2 Normal forms desirable forms for relations in DB design eliminate redundancies avoid update anomalies enforce integrity constraints.
Relational data objects 1 Lecture 6. Relational data objects 2 Answer to last lectures activity.
Introduction to SQL 1 Lecture 5. Introduction to SQL 2 Note in different implementations the syntax might slightly differ different features might be.
1 Term 2, 2004, Lecture 3, NormalisationMarian Ursu, Department of Computing, Goldsmiths College Normalisation 5.
Functional dependencies 1. 2 Outline motivation: update anomalies cause: not expressed constraints on data (FDs) functional dependencies (FDs) definitions.
Relational operators 1 Lecture 7 Relational Operators.
Relational data integrity
Dependency preservation, 3NF revisited and BCNF
Normal forms - 1NF, 2NF and 3NF
Data manipulation operations on views 1. 2 Outline retrieval operations in theory in practice (SQL92 and PostgreSQL) update operations in theory - basics.
1 Term 2, 2004, Lecture 2, Normalisation - IntroductionMarian Ursu, Department of Computing, Goldsmiths College Normalisation Introduction.
1 Term 2, 2004, Lecture 6, Views and SecurityMarian Ursu, Department of Computing, Goldsmiths College Views and Security 3.
1 Term 2, 2007, Lectures 2/3, NormalisationD. Tidhar (based on M. Ursu) Department of Computing, Goldsmiths College Normalisation 5.
1 Constraints and Updating Hugh Darwen CS252.HACD: Fundamentals of Relational Databases Section 7: Constraints.
1 Database Design Issues, Part I Hugh Darwen CS252.HACD: Fundamentals of Relational Databases Section.
CS 319: Theory of Databases
Dr. Alexandra I. Cristea CS 319: Theory of Databases.
Dr. Alexandra I. Cristea CS 319: Theory of Databases: C3.
Dr. A.I. Cristea CS 319: Theory of Databases: FDs.
ZMQS ZMQS
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
ABC Technology Project
© S Haughton more than 3?
Twenty Questions Subject: Twenty Questions
Squares and Square Root WALK. Solve each problem REVIEW:
Schema Refinement: Normal Forms
© 2012 National Heart Foundation of Australia. Slide 2.
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Functional Dependencies and Normalization for Relational Databases
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
11 = This is the fact family. You say: 8+3=11 and 3+8=11
Week 1.
We will resume in: 25 Minutes.
1 Unit 1 Kinematics Chapter 1 Day
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Equivalence Relations
Shantanu Narang.  Background  Why and What of Normalization  Quick Overview of Lower Normal Forms  Higher Order Normal Forms.
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.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
©Silberschatz, Korth and SudarshanC.1Database System Concepts, 5 th Ed. Appendix C: Advanced Relational Database Design.
Chapter 13 Further Normalization II: Higher Normal Forms.
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.
Normalization Ioan Despi 2 The basic objective of logical modeling: to develop a “good” description of the data, its relationships and its constraints.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
Advanced Database System
Fourth normal form: 4NF.
Presentation transcript:

5NF and other normal forms

Outline n-decomposability 3D constraint join dependency 5NF non-5NF - update anomalies problems in bringing a relation to 5NF other normal forms

Always two projections? so far every relation was non-loss decomposable into two projections is this always possible? n-decomposable relations

Courses - tutors - levels (CTL)

CTL - 2 attribute projections CL

CTL - 3-decomposable the join of any two projections is not CTL; e.g: join(CT, TL) Extra!

Constraint 3D Let R be a degree 3 relation. IF (a, b, x)  R AND (a, y, c)  R AND (z, b, c)  R THEN (a, b, c)  R

Constraint 3D illustrated on the CTL relation IF tutor t1 teaches subject s1 AND level l1 studies subject s1 AND tutor t1 teaches level l1 THEN tutor t1 teaches subject s1 for level l1 note: this constraint is not expressed in CTL

Constraint 3D and Join Dependency 4NF does not express the constraint 3D the constraint 3D is a facet of a more general constraint: join dependency

Join dependency Let R be a relation. Let A, B, ..., Z be arbitrary subsets of R’s attributes. R satisfies the JD  ( A, B, ..., Z ) if and only if R is equal to the join of its projections on A, B, ..., Z

5 NF R is in 5NF if and only if every join dependency in R is implied by the candidate keys of R 5NF is always achievable

Explanation a join dependency,  (A, B, …, Z), is implied by the candidate keys, K1, …, Km of R if the fact that K1, …, Km are candidate keys for R determine the fact that R has the JD  (A, B, …, Z)

Illustration - positive example consider R (S_id, S_name, Status, City) with S_id and S_name candidate keys  ({S_id, S_name, Status}, {S_id, City}) is a JD because S_id is a candidate key in R  ({S_id, S_name}, {S_id, Status}, {S_name, City}) is a JD because S_id and S_name are both candidate keys in R

Illustration - negative example consider CTL (Course, Tutor, Level) with (Course, Tutor, Level) - candidate key (and an extra constraint : constraint 3D) ({Course, Tutor}, {Course, Level}, {Tutor, Level}) is a JD, but this is not due to the CK, but to the constraint 3D if CTL had not had constraint 3D, would it have been in 5NF?

Not 5NF - update anomalies CTL satisfies  ( {Course, Tutor}, {Tutor, Level}, {Course, Level} ) insert (Programming, M. Ursu, Level2) what else must be done?

Not 5NF - update anomalies CTL satisfies the same JD as before delete (Databases, M. Ursu, Level2) what else must be done?

JDs and MVDs Fagin’s theorem restated R ( A, B, C ) satisfies  ( AB, AC ) if and only if it satisfies the MVDs A B | C JD is the most general form of dependency (read as determination) possible between the attributes of a relation (in the relational model)

Activity Is 4NF subsumed by 5NF? Can you prove this using Fagin’s theorem and the definitions for 4 and 5 NF?

Problems in bringing a relation to 5NF check whether all JDs are implied by the candidate keys Fagin : provides an algorithm for doing this for any relation, given all its JDs and all candidate keys discover all JDs for a given relation they do not have that intuitive meaning as FDs or MVDs

Concluding remarks 5NF is the ultimate normal form with respect to projection / join 5NF is guaranteed to be free of all anomalies that can be eliminated via projections determining whether a relation is in 4NF but not in 5NF is still fuzzy very rare in practice

Recap JD - a more general constraint than MD a relation can be in 4NF and have un-expressed JDs this results in update anomalies such a relation can be decomposed (via projection) into an equivalent set of 5NF relations a relation is 5NF if all its JDs are deducible from its candidate keys for a relation in 4NF but not in 5NF, an unexpressed JD is a possible decomposition (towards 5NF)

Other normal forms FDs, MVDs or JDs are not used domain-key normal form R is in DK/NF if and only if every constraint of R is a logical consequence of domain constraints and (candidate) key constraints restriction-union normal form decomposing operator: restriction abusing the language it can be said that: this normalisation theory is orthogonal on the “projection” normalisation theory