Fourth normal form: 4NF.

Slides:



Advertisements
Similar presentations
Fourth normal form: 4NF 1. 2 Normal forms desirable forms for relations in DB design eliminate redundancies avoid update anomalies enforce integrity constraints.
Advertisements

5NF and other normal forms
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.
Dependency preservation, 3NF revisited and BCNF
Normal forms - 1NF, 2NF and 3NF
1 Term 2, 2004, Lecture 2, Normalisation - IntroductionMarian Ursu, Department of Computing, Goldsmiths College Normalisation Introduction.
1 Term 2, 2007, Lectures 2/3, NormalisationD. Tidhar (based on M. Ursu) Department of Computing, Goldsmiths College Normalisation 5.
Shantanu Narang.  Background  Why and What of Normalization  Quick Overview of Lower Normal Forms  Higher Order Normal Forms.
Normalisation to 3NF Database Systems Lecture 11 Natasha Alechina.
Defined by Edgar Codd in 1970 Defined by Edgar Codd in 1970 Considered ingenious but impractical Considered ingenious but impractical Conceptually simple.
1/22/20091 Study the methods of first, second, third, Boyce-Codd, fourth and fifth normal form for relational database design, in order to eliminate data.
Copyright © 2004 Pearson Education, Inc.. Chapter 10 Functional Dependencies and Normalization for Relational Databases.
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Multi-valued Dependencies. 2 Multivalued Dependencies There are database schemas in BCNF that do not seem to be sufficiently normalized. Consider a.
4 TH NORMAL FORM By: Karen McVay. REVIEW OF NFs 1NF  All values of the columns are atomic. That is, they contain no repeating values. 1NF  All values.
Introduction to Schema Refinement
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
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.
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.
Design Process - Where are we?
9/23/2012ISC329 Isabelle Bichindaritz1 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,
CS 338Database Design and Normal Forms9-1 Database Design and Normal Forms Lecture Topics Measuring the quality of a schema Schema design with normalization.
Ch 7: Normalization-Part 1
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
Objectives of Normalization  To create a formal framework for analyzing relation schemas based on their keys and on the functional dependencies among.
Advanced Database System
Logical Database Design and Relational Data Model Muhammad Nasir
Relational Data Model, Review Relation Tuple Attribute Domains Candidate key, primary key Key attribute, non-key attribute.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts.
4TH NORMAL FORM By: Karen McVay.
Normalization Database Management Systems, 3rd ed., Ramakrishnan and Gehrke, Chapter 19.
Functional Dependency and Normalization
Advanced Normalization
Chapter 15 Relational Design Algorithms and Further Dependencies
CHAPTER 14 Basics of Functional Dependencies and Normalization for Relational Databases.
Normalization Karolina muszyńska
Gergely Lukács Pázmány Péter Catholic University
A brief summary of database normalization
Higher Forms of Normalization
CS411 Database Systems 08: Midterm Review Kazuhiro Minami 1.
Database Design Dr. M.E. Fayad, Professor
STRUCTURE OF PRESENTATION :
3.1 Functional Dependencies
Normalization Refine data To attain a good DB design
Problems in Designing Schema
Module 5: Overview of Normalization
Chapter 14 Normalization – Part I Pearson Education © 2009.
Distributed Database Management System
Multivalued Dependencies & Fourth Normal Form
Multivalued Dependencies & Fourth Normal Form
Normalization.
Decomposition and Higher Forms of Normalization
Normalisation to 3NF.
CS 405G: Introduction to Database Systems
國立臺北科技大學 課程:資料庫系統 2015 fall Chapter 14 Normalization.
Schema Refinement and Normal Forms
NORMALIZATION FIRST NORMAL FORM (1NF):
Chapter Outline 1 Informal Design Guidelines for Relational Databases
Database Design Dr. M.E. Fayad, Professor
Database.
Chapter 3: Multivalued Dependencies
Chapter 7a: Overview of Database Design -- Normalization
Functional Dependencies and Normalization
Presentation transcript:

Fourth normal form: 4NF

Normal forms desirable forms for relations in DB design eliminate redundancies avoid update anomalies enforce integrity constraints in one sentence: produce a good representation of the real world formally defined, based on semantic concepts not a panacea

2NF, 3NF and BCNF defined based on FDs decomposition procedure : projection any relation can be brought to any (of the above) NF accompanied by normalisation procedures

4NF based on another semantic concept (not FDs) (i.e. capturing different semantic aspects (constraints) of the real life system)

Motivation - 4NF courses - tutors - reference books assumptions for a course - any number of tutors and any numbers of books a book can be used for any number of courses a tutor can teach any number of courses no link between tutors and books (!!!)

Un-normalised relation (CTB)

1N relation

Note IF (c1, t1, b1) and (c1, t2, b2) exist as tuples in the relation THEN (c1, t1, b2) and (c1, t2, b1) also exist in the relation

Question what normal forms is this relation in? helping question what functional dependencies can you identify? ANSWERS 1. The relation is in BCNF 2. There are no functional dependencies 3. if a relation is in a normal form defined based on FD it does not mean that it is a good representation of reality; even though in BCNF it still presents a great deal of redundancies and also update anomalies ...

Shortcomings redundancy therefore: update anomalies e.g. add a new tutor, C. Fox, for the Databases course: both tuples, (Databases, C. Fox, Introduction to DB) and (Databases, C. Fox, DB Design), have to be added could you think of a better solution? this is a “problem” BCNF relation what do you conclude about the studied normal forms?

Common-sense solution separate independent repeating groups decompose the un-normalised relation bring it to 1NF the solution: shortcomings - removed non-loss decomposition

Decompose the un-normalised relation

Bring to 1NF

Solution what is the theoretical basis? not FDs (there aren’t any) multi-valued dependencies (MVDs) generalisation of FDs e.g. Course Tutor each course has a well defined set of tutors in the relation CTB, Tutor depends on the value of Course alone (Book does not influence)

Multi-valued dependency - simple Let R be a relation and A and B arbitrary sets of attributes of R. There is a multi-valued dependency from A to B A B if and only each A value exactly determines a set of B values, independently of the other attributes

Multi-valued dependency - Date Let R be a relation; A, B and C are arbitrary sets of attributes of R A multi-determines B (B is multi-dependent on A) A B if and only if the set of B values matching an (A, C) pair depends only on the A value.

Multi-valued dependency (Elmasri and Navathe, 2000, p. 514) Let R be a relation and X and Y arbitrary sets of attributes of R; if for any 2 tuples (in any extension) t1 and t2 with the property t1[X] = t2[X] there exists 2 tuples t3 and t4 such that (Z = R - (XY)) t1[X] = t3[X] = t4[X] t1[Y] = t3[Y] and t2[Y] = t4[Y] t1[Z] = t2[Z] and t3[Z] = t4[Z] then X Y

Trivial MVDs R, is a relation; X and Y arbitrary sets of attributes of R X Y is trivial if and only if Y  X or X  Y = R a trivial MVD does not represent a constraint

Questions is every FD a MVD? is every MVD a FD?

Towards 4NF MVDs are a generalisation of FDs the existence of non-trivial MVDs that are not FDs causes problems AIM: to eliminate such situations

Theorems R (A, B, C) and (Fagin) A B R (A, B, C) A C R = join ({A, B}, {A, C}) if and only if A B | C

4NF R is in 4NF if and only if any MVD is either (Connolly): trivial, or it is also a FD (Connolly): A relation is in 4NF if and only if “it is in BCNF and contains no non-trivial multi-valued dependencies” can you spot the error in the definition? 4NF is always achievable

Fagin’s theorem Let R = (A, B, C) and A ->> B | C then R = (A, B) join (A, C) similar in form with the variant for FDs

Example

Discussion R = (Patient, Disease, Doctor) a patient has a number of diseases and, independently of them is assigned a number of doctors; therefore Patient ->> Disease | Doctor each disease is treated by a certain number of doctors and, independently of this, there is a certain number of patients that suffer from each disease; therefore: Disease ->> Doctor | Patient a patient, for a certain disease, is assigned only one doctor; therefore: (Patient, Disease) -> Doctor and NO MVDs exist

Discussion R = (Patient, Disease, Doctor) each patient suffers from a number of diseases (independently of doctors) and each disease is treated by a number of doctors (independently of the patients that suffer from it); can we say that Patient ->> Disease and Disease ->> Doctor ? have we not already discussed the above case?

Discussion what about R = (Patient, Disease, Treatment, Nurse) where a patient can have a number of diseases (independently of treatments and nurses) a disease has a number of treatments (independently of patients and nurses); a treatment is administered by a number of nurses (independently of patients and diseases).

Discussion what about R = (Patient, Disease, Doctor, Nurse) where a patient has a number of diseases independently of doctors and nurses a patient has a unique doctor for a given disease a doctor has (works with) a number of nurses, independently of patients and diseases

Conclusion 2NF, 3NF and BCNF based on FDs there are other constraints that can be expressed through projection multi-valued dependency 4NF Fagin