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

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

Relational Database Design

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

Functional Dependencies & Normalization. Dr. Bassam Hammo

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

Schema Refinement. Feb 4, 2010

Schema Refinement and Normal Forms

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

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

Schema Refinement and Normalization

CSIT5300: Advanced Database Systems

Schema Refinement and Normal Forms Chapter 19

Schema Refinement & Normalization Theory

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

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

SCHEMA NORMALIZATION. CS 564- Fall 2015

Functional Dependency and Algorithmic Decomposition

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

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

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

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

Functional Dependencies

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

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms. Chapter 19

Schema Refinement and Normal Forms

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

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

Functional Dependencies

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

CSE 132B Database Systems Applications

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

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

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

HKBU: Tutorial 4

Functional. Dependencies. Functional Dependency. Definition. Motivation: Definition 11/12/2013

Relational Design Theory I. Functional Dependencies: why? Redundancy and Anomalies I. Functional Dependencies

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

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

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

LOGICAL DATABASE DESIGN Part #1/2

Schema Refinement and Normal Forms. Why schema refinement?

Chapter 11, Relational Database Design Algorithms and Further Dependencies

Normaliza)on and Func)onal Dependencies

Chapter 7: Relational Database Design

Constraints: Functional Dependencies

Chapter 8: Relational Database Design

Relational-Database Design

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

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

Schema Refinement: Other Dependencies and Higher Normal Forms

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

Consider a relation R with attributes ABCDEF GH and functional dependencies S:

Functional Dependencies and Normalization

Functional Dependencies

Relational Design: Characteristics of Well-designed DB

Functional Dependencies and Normalization. Instructor: Mohamed Eltabakh

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

Constraints: Functional Dependencies

Design theory for relational databases

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

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

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

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

Consider a relation R with attributes ABCDEF GH and functional dependencies S:

CSC 261/461 Database Systems Lecture 13. Spring 2018

Information Systems (Informationssysteme)

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

Unit 3 - Functional Dependency and Decomposition

12/3/2010 REVIEW ALGEBRA. Exam Su 3:30PM - 6:30PM 2010/12/12 Room C9000

Functional Dependencies and Normalization

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

INF1383 -Bancos de Dados

Functional Dependencies

Databases 2012 Normalization

Database Normaliza/on. Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata

Lecture 6 Relational Database Design

CS122A: Introduction to Data Management. Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li

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

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

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

Design Theory for Relational Databases

DESIGN THEORY FOR RELATIONAL DATABASES. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018

Functional Dependency Theory II. Winter Lecture 21

Introduction to Data Management. Lecture #10 (DB Design Wrap-up)

Relational Design Theory

Database Design and Implementation

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

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

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

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

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

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

Introduction to Data Management CSE 344

CSE 544 Principles of Database Management Systems

Functional Dependencies. Chapter 3

Data Dependencies in the Presence of Difference

Lecture 15 10/02/15. CMPSC431W: Database Management Systems. Instructor: Yu- San Lin

Transcription:

Functional Dependencies Getting a good DB design Lisa Ball November 2012

Outline (2012) SEE NEXT SLIDE FOR ALL TOPICS (some for you to read) Normalization covered by Dr Sanchez Armstrong s Axioms other axioms that can be proven from Closure {} + uses Armstrong s axioms to find all valid f.d. s Minimal Set Closure Equivalence show equivalence of 2 sets of f.d.s Lossless joins (2 tables only) prevents spurious (incorrect) rows on joins 2

Topics Chapter 15 Normalization (covered in other lectures) Informal Design Guidelines (15.1) Introduction to Functional Dependencies (15.2) basic idea Normalization (15.3, 15.4) 2NF (no partial dependencies) 3NF (no transitive dependencies) Chapter 16 Functional Dependencies Functional Dependency Inference Rules (16.1.1) Armstrong s Axioms & other axioms that can be proven from Closure {} + uses axioms to find all valid f.d. s Equivalence (16.1.2) show equivalence of 2 sets of f.d.s Minimal Sets (16.1.3) Lossless joins: 2 tables only (16.2.4) prevents spurious (incorrect) rows on joins Algorithms for Relational DB Schema Design to 3NF (16.3.1) NULLS, Dangling Tuples, and Alternative Relational Designs (16.4) 3

Chapter 15 & Comment on Ch 16 Dr Ball s absence (2012) Covered by Dr Sanchez Some of our chapter 16 topics started out of order this year (2012). closure & minimal cover covered before Additional axioms (IR4-6) let s do topics in same order as text some will be repeat 4

Some Normalization Comments (a look back-ch 15) Examples VIN Make, Model, Color ISBN Title SSN Name (but not address- e.g. spouses) Sample data only proves FD s that do NOT hold A B C D A B? No. Look at Y-X & Y-Z X U X Y Y X Z X Z Y Y Y Y Z W Z A C No A D No D? No??? Can t tell B,C (all vals unique) 6

Armstrong s Axioms (inference rules) for FD s (IR1) Reflexive Rule If Y X, X Y attributes determine themselves (IR2) Augmentation Rule X Y XZ YZ (or XZ Y) adding attributes on both sides yields another valid f.d. (IR3) Transitive Rule X Y, Y Z X Z Provided our initial f.d. s are sound, these rules are sound (find only valid new f.d. s) and complete (can find all valid f.d. s) 7

Additional Provable Axioms (FD s) Additional Axioms Decomposition (projective) X YZ X Y Union (additive) X Y, X Z Pseudotransitive X Y, WY Z X YZ WX Z Given with proofs in text, pages 546-547 you should be able to do, along with others 8

Disproof of Axioms (FD s) Does this follow from the axioms? just be able to show one disproof example X Z, Y Z X Y??? Just have to show 1 disproof you should be able to do, along with others X Y Z A D R This satisfies lhs, NOT rhs (X Y ) A E R B E R 9

Closure of a set of f.d. s: F + Definition: Closure the set of all fd s that include F (given) and all dependencies that can be inferred from F Use axioms (inference rules) to derive F + (closure) For each lhs, find closure (loop through) alg. 16.1 Let s look at examples. Also in text (employee, project, hours) Why? only way to determine if 2 sets of f.d. s are equivalent we start with semantically obvious ones we want smaller set in normalization algorithms 10

Closure Examples Paper copies for now 2012 (already covered) you: go practice some more, now using all 6 inference rules 11

Equivalence of 2 sets of f.d. s E B A D A AB D try to remove lhs attr s B + = {A,B,D} D + = {A,D} AB + = {A,B,D} Are these covered by F? YES F B D D A try to remove lhs attr s B + = {A,B,D} D + = {A,D} Are these covered by E? YES 12

Minimal Set (Cover) No redundancies in standard form different sets lead to different schema designs. we want minimal set before we normalize simplest schema design 3 conditions single attribute on each rhs can t remove any f.d. and still have equivalence (same closure) can t remove any lhs attr s and still have equivalence 2012: largely covered (use axioms) 13

Lossless Joins: 2 tables. Lossless joins: 2 tables only (16.2.4) prevents spurious (incorrect) rows on joins Algorithms exists for > 2 tables we don t cover thesee 14

Testing for Lossless Joins: 2 tables. PROPERTY LJ1 (lossless join test for binary decompositions): A decomposition D = {R1, R2} of R has the lossless join property with respect to a set of functional dependencies F on R if and only if either The f.d. ((R1 R2) (R1- R2)) is in F +, or The f.d. ((R1 R2) (R2 - R1)) is in F +. 15

Lossless Joins: Example see text for now 16

EXAMPLES & EXTERNAL SOURCES SECTION 17

Examples & Sources Textbook course Page: Sample Exams Youtube: Univ. Houston Clear Lake 18