Schema Refinement: Other Dependencies and Higher Normal Forms

Similar documents
Constraints: Functional Dependencies

Relational Database Design

UVA UVA UVA UVA. Database Design. Relational Database Design. Functional Dependency. Loss of Information

Functional Dependencies

Constraints: Functional Dependencies

Functional Dependencies & Normalization. Dr. Bassam Hammo

Normalization. October 5, Chapter 19. CS445 Pacific University 1 10/05/17

COSC 430 Advanced Database Topics. Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago

Relational Database Design Theory Part II. Announcements (October 12) Review. CPS 116 Introduction to Database Systems

Background: Functional Dependencies. æ We are always talking about a relation R, with a æxed schema èset of attributesè and a

Databases Lecture 8. Timothy G. Griffin. Computer Laboratory University of Cambridge, UK. Databases, Lent 2009

Schema Refinement. Feb 4, 2010

Review: Keys. What is a Functional Dependency? Why use Functional Dependencies? Functional Dependency Properties

Functional Dependencies. Applied Databases. Not all designs are equally good! An example of the bad design

Problem about anomalies

Functional Dependency and Algorithmic Decomposition

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms. Why schema refinement?

Chapter 10. Normalization Ext (from E&N and my editing)

CSE 132B Database Systems Applications

SCHEMA NORMALIZATION. CS 564- Fall 2015

CS54100: Database Systems

Relational Design: Characteristics of Well-designed DB

INF1383 -Bancos de Dados

A few details using Armstrong s axioms. Supplement to Normalization Lecture Lois Delcambre

Schema Refinement and Normal Forms. The Evils of Redundancy. Schema Refinement. Yanlei Diao UMass Amherst April 10, 2007

CS322: Database Systems Normalization

Database Design and Normalization

Lecture 6 Relational Database Design

Relational Design Theory

Shuigeng Zhou. April 6/13, 2016 School of Computer Science Fudan University

Information Systems for Engineers. Exercise 8. ETH Zurich, Fall Semester Hand-out Due

DECOMPOSITION & SCHEMA NORMALIZATION

Introduction. Normalization. Example. Redundancy. What problems are caused by redundancy? What are functional dependencies?

Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1

Chapter 7: Relational Database Design

Schema Refinement and Normal Forms. Chapter 19

Schema Refinement & Normalization Theory

Chapter 7: Relational Database Design. Chapter 7: Relational Database Design

Database Design and Normalization

Schema Refinement and Normal Forms Chapter 19

Chapter 3 Design Theory for Relational Databases

Lossless Joins, Third Normal Form

Schema Refinement and Normal Forms

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 10. Logical consequence (implication) Implication problem for fds

Databases 2012 Normalization

Schema Refinement and Normalization

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Example (Contd.

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Refining an ER Diagram

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) CIS 330, Spring 2004 Lecture 11 March 2, 2004

Schema Refinement and Normal Forms

10/12/10. Outline. Schema Refinements = Normal Forms. First Normal Form (1NF) Data Anomalies. Relational Schema Design

FUNCTIONAL DEPENDENCY THEORY II. CS121: Relational Databases Fall 2018 Lecture 20

Database Design and Implementation

Chapter 8: Relational Database Design

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) [R&G] Chapter 19

CSC 261/461 Database Systems Lecture 13. Spring 2018

The Evils of Redundancy. Schema Refinement and Normalization. Functional Dependencies (FDs) Example: Constraints on Entity Set. Refining an ER Diagram

CMPS Advanced Database Systems. Dr. Chengwei Lei CEECS California State University, Bakersfield

The Evils of Redundancy. Schema Refinement and Normal Forms. Functional Dependencies (FDs) Example: Constraints on Entity Set. Example (Contd.

Functional Dependency Theory II. Winter Lecture 21

Schema Refinement. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

Normaliza)on and Func)onal Dependencies

Schema Refinement and Normal Forms. Case Study: The Internet Shop. Redundant Storage! Yanlei Diao UMass Amherst November 1 & 6, 2007

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 9. Informal exercise from last lecture. Example (from Stanczyk et al.

Relational Database Design

CSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018

Schema Refinement and Normal Forms

CSIT5300: Advanced Database Systems

Database Design: Normal Forms as Quality Criteria. Functional Dependencies Normal Forms Design and Normal forms

Data Bases Data Mining Foundations of databases: from functional dependencies to normal forms

Chapter 3 Design Theory for Relational Databases

Copyright is owned by the Author of the thesis. Permission is given for a copy to be downloaded by an individual for the purpose of research and

Introduction to Data Management. Lecture #6 (Relational Design Theory)

Functional Dependencies. Getting a good DB design Lisa Ball November 2012

Introduction to Data Management. Lecture #6 (Relational DB Design Theory)

Normal Forms (ii) ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

Global Database Design based on Storage Space and Update Time Minimization

CSC 261/461 Database Systems Lecture 11

Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #15: BCNF, 3NF and Normaliza:on

FUNCTIONAL DEPENDENCY THEORY. CS121: Relational Databases Fall 2017 Lecture 19

Information Systems (Informationssysteme)

Normal Forms. Dr Paolo Guagliardo. University of Edinburgh. Fall 2016

Normal Forms 1. ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

CAS CS 460/660 Introduction to Database Systems. Functional Dependencies and Normal Forms 1.1

Relational-Database Design

Functional Dependencies and Normalization

CMPT 354: Database System I. Lecture 9. Design Theory

CSC 261/461 Database Systems Lecture 12. Spring 2018

Kapitel 3: Formal Design

On a problem of Fagin concerning multivalued dependencies in relational databases

But RECAP. Why is losslessness important? An Instance of Relation NEWS. Suppose we decompose NEWS into: R1(S#, Sname) R2(City, Status)

Informationslogistik Unit 7: Conceptual Design of Databases Normalization

CSE 544 Principles of Database Management Systems

Design Theory for Relational Databases. Spring 2011 Instructor: Hassan Khosravi

Functional Dependencies

CSC 261/461 Database Systems Lecture 8. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

Relational Design Theory II. Detecting Anomalies. Normal Forms. Normalization

Transcription:

Schema Refinement: Other Dependencies and Higher Normal Forms Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Higher Normal Forms 1 / 14

Outline 1 Multivalued Dependencies Reasoning about MVDs Lossless-Join Decompositions Fourth Normal Form 2 Other Dependencies (University of Waterloo) Higher Normal Forms 2 / 14

Beyond Functional Dependencies There exist anomalies/redundancies in relational schemas that cannot be captured by FDs. Example: consider the following table: Course Teacher Book Math Smith Algebra Math Smith Calculus Math Jones Algebra Math Jones Calculus Advanced Math Smith Calculus Physics Black Mechanics Physics Black Optics There are no (non-trivial) FDs that hold on this scheme; therefore the scheme (Course, Set-of-teachers, Set-of-books) is in BCNF. (University of Waterloo) Higher Normal Forms 3 / 14

Outline 1 Multivalued Dependencies 2 Other Dependencies (University of Waterloo) Higher Normal Forms 4 / 14

Multivalued Dependencies (MVD) CTB table contains redundant information because: whenever (c, t 1, b 1 ) CTB and (c, t 2, b 2 ) CTB then also (c, t 1, b 2 ) CTB and, by symmetry, (c, t 2, b 1 ) CTB we say that a multivalued dependency (MVD) C T (and C B as well) holds on CTB. given a course, the set of teachers and the set of books are uniquely determined and independent. (University of Waterloo) Higher Normal Forms 5 / 14

Another Example Course Teacher Hour Room Student Grade CS101 Jones M-9 2222 Smith A CS101 Jones W-9 3333 Smith A CS101 Jones F-9 2222 Smith A CS101 Jones M-9 2222 Black B CS101 Jones W-9 3333 Black B CS101 Jones F-9 2222 Black B FDs: C T, CS G, HR C, HT R, and HS R MVDs: C HR (University of Waterloo) Higher Normal Forms 6 / 14

Axioms for MVDs 1 Y X X Y (reflexivity) 2 X Y X (R Y ) (complementation) 3 X Y XZ YZ (augmentation) 4 X Y, Y Z X (Z Y ) (transitivity) 5 X Y X Y (conversion) 6 X Y, XY Z X (Z Y ) (interaction) Theorem: Axioms for FDs (1)-(6) are sound and complete for logical implication of FDs and MVDs. (University of Waterloo) Higher Normal Forms 7 / 14

Example In the CTHRSG schema, C SG can be derived as follows: 1 C HR 2 C T (from C T ) 3 C CTSG (complementation of (1)) 4 C CT (augmentation of (2) by C) 5 CT CTSG (augmentation of (3) by T ) 6 C SG (transitivity on (4) and (5)) (University of Waterloo) Higher Normal Forms 8 / 14

Dependency Basis Definition: A dependency basis for X with respect to a set of FDs and MVDs F is a partition of R X to sets Y 1,..., Y k such that F = X Z if and only if Z X is a union of some of the Y i s. unlike for FDs we can t split right-hand sides of MVDs to single attributes (cf. minimal cover). the dependency basis of X w.r.t. F can be computed in PTIME [Beeri80]. The dependency basis of CTHRSG with respect to C is [T, HR, SG] (University of Waterloo) Higher Normal Forms 9 / 14

Lossless-Join Decomposition similarly to the FD case we want to decompose the schema to avoid anomalies a lossless-join decomposition (R 1, R 2 ) of R with respect to a set of MVDs F: or, by symmetry F = (R 1 R 2 ) (R 1 R 2 ) F = (R 1 R 2 ) (R 2 R 1 ) this condition implies the one for FDs (in only FDs appear in F). (University of Waterloo) Higher Normal Forms 10 / 14

Fourth Normal Form (4NF) Definition: Let R be a relation schema and F a set of FDs and MVDs. Schema R is in 4NF if and only if whenever (X Y ) F + and XY R, then either (X Y ) is trivial (Y X or XY = R), or X is a superkey of R A database schema {R 1,..., R n } is in 4NF if each relation schema R i is in 4NF. use BCNF-like decomposition procedure to obtain a lossless-join decomposition into 4NF. (University of Waterloo) Higher Normal Forms 11 / 14

Example The CTB schema can be decomposed to 4NF (using C T ) as follows: Course Math Math Physics Advanced Math Teacher Smith Jones Black Smith Course Math Math Physics Physics Advanced Math Book Algebra Calculus Mechanics Optics Calculus no FDs here! (University of Waterloo) Higher Normal Forms 12 / 14

Outline 1 Multivalued Dependencies 2 Other Dependencies (University of Waterloo) Higher Normal Forms 13 / 14

Other Dependencies Join Dependency on R [R 1,..., R k ] holds if I = π R1 (I)... π Rk (I) generalization of an MVD X Y is the same as [XY, X(R Y )] cannot be simulated by MVDs no axiomatization exists Project-Join NF (5NF) [R 1,..., R k ] implies R i is a key. Inclusion Dependency on R and S R[X] S[Y ] holds if π X (I R ) π Y (I S ) relates two relations foreign-key relationships (University of Waterloo) Higher Normal Forms 14 / 14