Chapter 16: Relational Database Design and Further Dependencies

Slides:



Advertisements
Similar presentations
Functional dependencies 1. 2 Outline motivation: update anomalies cause: not expressed constraints on data (FDs) functional dependencies (FDs) definitions.
Advertisements

Normal forms - 1NF, 2NF and 3NF
CS 319: Theory of Databases
Dr. Alexandra I. Cristea CS 319: Theory of Databases: C3.
Functional Dependencies and Normalization for Relational Databases
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Announcements Read 6.1 – 6.3 for Wednesday Project Step 3, due now Homework 5, due Friday 10/22 Project Step 4, due Monday Research paper –List of sources.
Schema Refinement and Normal Forms Given a design, how do we know it is good or not? What is the best design? Can a bad design be transformed into a good.
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.
Manipulating Functional Dependencies Zaki Malik September 30, 2008.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Further Dependencies by Pinar Senkul resources: mostly froom Elmasri, Navathe and other books.
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.
Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)
CS Algorithm : Decomposition into 3NF  Obviously, the algorithm for lossless join decomp into BCNF can be used to obtain a lossless join decomp.
Normal Form Design addendum by C. Zaniolo. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Normal Form Design Compute the canonical cover.
1 Normalization Chapter What it’s all about Given a relation, R, and a set of functional dependencies, F, on R. Assume that R is not in a desirable.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Functional Dependencies and Normalization for Relational Databases by Pinar Senkul resources:
Cs3431 Normalization. cs3431 Why Normalization? To remove potential redundancy in design Redundancy causes several anomalies: insert, delete and update.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Databases 6: Normalization
METU Department of Computer Eng Ceng 302 Introduction to DBMS Relational Database Design Algorithms by Pinar Senkul resources: mostly froom Elmasri, Navathe.
Chapter 14 Advanced Normalization Transparencies © Pearson Education Limited 1995, 2005.
Chapter 11 Relational Database Design Algorithms and Further Dependencies Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
CS 405G: Introduction to Database Systems 16. Functional Dependency.
Relational Database Design by Relational Database Design by Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Instructor: Churee Techawut Functional Dependencies and Normalization for Relational Databases Chapter 4 CS (204)321 Database System I.
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.
SCUJ. Holliday - coen 1784–1 Schedule Today: u Normal Forms. u Section 3.6. Next u Relational Algebra. Read chapter 5 to page 199 After that u SQL Queries.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 11 Relational Database Design Algorithms and Further Dependencies.
Relational Database Design Algorithms and Further Dependencies.
Chapter 11: Relational Database Design Algorithms and Further Dependencies Chapter 11: Relational Database Design Algorithms and Further Dependencies 1.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Deanship of Distance Learning Avicenna Center for E-Learning 1 Session - 7 Sequence - 2 Normalization Functional Dependencies Presented by: Dr. Samir Tartir.
Chapter 7 Functional Dependencies Copyright © 2004 Pearson Education, Inc.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Ch 7: Normalization-Part 1
CS411 Database Systems Kazuhiro Minami 04: Relational Schema Design.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Relational Database Design Algorithms and Further Dependencies.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
11/06/97J-1 Principles of Relational Design Chapter 12.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
Chapter 16: Relational Database Design and Further Dependencies
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
Schedule Today: Next After that Normal Forms. Section 3.6.
Normalization Functional Dependencies Presented by: Dr. Samir Tartir
Relational Database Design by Dr. S. Sridhar, Ph. D
Advanced Normalization
Database.
Presentation transcript:

Chapter 16: Relational Database Design and Further Dependencies TA: Zhe Jiang zhe@cs.umn.edu Ref: Elmasri, Navathe, Fundamentals of Database Systems, 6th, Addison Wesley, ISBN-10: 0-13-608620-9.

Outline Big picture & motivation Simple case algorithm (part of 16.3.3) Formal algorithm Basic concepts (16.1): General case algorithm (16.3.3)

Database Design Phases Big Picture: Database Design Phases ER-Diagram Relational Tables Which choice is good? How to guarantee it? Formal Norm Theory

Motivation We have: Universal relational schema U(A1,A2, … An). A set of functional dependencies (FDs) from domain knowledge. Question: How do we decompose U into sub-relations, so as to satisfy 3NF?

Simple Case Decomposition Algorithm Motivation: Decompose universal relational schema into sub relations which satisfy 3NF Properties: Preserve dependencies (nonlossy design) Non-additive join property (no spurious tuples) Resulting relational schemas are in 3NF Problem Definition: Input: Universal Relation R and a set of functional dependencies F on the attributes of R Output: Sub-relations, FDs. Constraint: the three properties above

Simple Case Decomposition Algorithm Suppose the FD set given is already “good” minimal cover (defined later) Approach: For each LHS X in F, create a relation schema in D {X U {A1} U {A2} … U {Ak} }.where XAi only dependency with X as LHS. If none of the relation schemas in D contains a key of R, create one relation with key. (How? Introduce later) Eliminate redundant relations.

Simple Case Decomposition Algorithm Exercise: Universal relation FD: {PLC, LCAP, AC} Q: Does it satisfy 1NF, 2NF, 3NF? Q: How to decompose the relation to satisfy 3NF? Solution: R1(P,L,C); R2(L,C,A,P); R3(A,C) Already contains key. Remove redundant relations R1 and R3, final answer is R2(L,C,A,P).

General Case Decomposition Algorithm New info: Transform the given FD set into minimal cover New info: If no key exists, find key of U, then create a relation contain key We will introduce some basic concepts, then formal algorithm

Basic Concept Inference rules: One FD could infer another trivial: IR1: IR1 (reflexive rule) If X Y, then X Y. non-trivial: IR2-IR4 {XY} |= XZYZ {XY, YZ} |= XZ {XYZ} |=XY Closure of set of dependencies Closure of F: F+, set of all FDs could be inferred. Use IR1 to IR3;

Basic Concepts Closure of left-hand-side under dependency set Algorithm 16.1 Start: X+={X} Grow X+ with new attributes determined by elements in X+ Repeat 2 until can’t grow any more. Exercise: Given: F={XYZ, XW, WU, YV}, U(X,Y,Z,W,U,V) Find: X+ ?

Basic Concepts Equivalence of functional dependencies sets Definition Cover: F covers E if F+ contains E. Equivalent FD sets: Algorithm Check if all left-hand-sides’ closures are same Minimal Cover of dependency set F definition: Can’t find subset that is equivalent to F

Basic Concept Minimal Cover of dependency set F Example: break down right-hand-side, X{A1,A2,…An} to XA1, XA2, …XAn Try reduce size of LHS X in F, e.g. changing X into {X-B} still equivalent to F? Try reduce unnecessary FD in F, e.g. remove XA in F, if result still equivalent to F. Example: F={PLCA, LCAP, AC} What is “minimal cover” of F?

Basic Concepts Algorithm to find key of R&F Example: Start with K=R. Find A in R such that (K-A)+ contain all attributes. Repeat until size of K is as small as possible Example: U(Emp_ssn, Pno, Esal, Ephone, Dno, Pname, Plocation) F={Emp_ssnEsal, Ephone, Dno; PnoPname, plocation}; What is the key?

Decomposition Algorithm: Exercise FD3 FD1: Property_id Lot#, County, Area FD2: Lot#, County Area, Property_id FD3: AreaCounty Simpler Version: F={PLCA, LCAP, AC} What is the minimal cover G? Decompose G

Decomposition Algorithm Example Simpler Version: F={PLCA, LCAP, AC} First Case: Minimal cover GX: F: {PL, PC, PA, LCA, LCP,AC} Minimal cover GX: {PLC, LCAP, AC} Design X: 3. R1(P,L,C), R2(L,C,A,P), and R3(A,C) 4. R2(L,C,A,P)

Decomposition Algorithm Example Simpler Version: F={PLCA, LCAP, AC} Second Case: Minimal cover GX: F: {PL, PC, PA, LCA, LCP,AC} Minimal cover GX: {PLA, LCP, AC} Design Y: 3. S1(P,A,L), S2(L,C,P), and S3(A,C) 4. No redundant relations.

Exercise Given: Universal relation U(A,B,C,D,E,F,G,H,I,J) Functional dependencies F={ {A,B}{C}, {B,D}{E,F}, {A,D}{G,H}, {A}{I}, {H}{J} }. Decompose it into 3NF?