Exercise R(A,B,C,D) with FD’s ABC, CD, and DA

Slides:



Advertisements
Similar presentations
Schema Refinement: Normal Forms
Advertisements

Lecture 21 CS 157 B Revision of Midterm3 Prof. Sin-Min Lee.
CS 440 Database Management Systems Practice problems for normalization.
Review for Final Exam Lecture Week 14. Problems on Functional Dependencies and Normal Forms.
1 Design Theory. 2 Minimal Sets of Dependancies A set of dependencies is minimal if: 1.Every right side is a single attribute 2.For no X  A in F and.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 227 Database Systems I Design Theory for Relational Databases.
Functional Dependencies
Functional Dependencies. Babies At a birth, there is one baby (twins would be represented by two births), one mother, any number of nurses, and a doctor.
Classroom Exercise: Normalization
Lossless Decomposition Elias Aseged SE 157B - DB 2.
Functional Dependencies Definition: If two tuples agree on the attributes A, A, … A 12n then they must also agree on the attributes B, B, … B 12m Formally:
The principal problem that we encounter is redundancy, where a fact is repeated in more than one tuple. Most common cause: attempts to group into one relation.
Department of Computer Science and Engineering, HKUST Slide 1 7. Relational Database Design.
CS411 Database Systems Kazuhiro Minami
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Database Systems Normal Forms. Decomposition Suppose we have a relation R[U] with a schema U={A 1,…,A n } – A decomposition of U is a set of schemas.
Schema Refinement and Normal Forms Chapter 19 1 Database Management Systems 3ed, R.Ramakrishnan & J.Gehrke.
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.
THIRD NORMAL FORM (3NF) A relation R is in BCNF if whenever a FD XA holds in R, one of the following statements is true: XA is a trivial FD, or X is.
Third Normal Form (3NF) Zaki Malik October 23, 2008.
Design Theory for RDB Normal Forms. Lu Chaojun, SJTU 2 Redundant because these info may be figured out by using FD s1  … What’s Bad Design? Redundancy.
3 Spring Chapter Normalization of Database Tables.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Functional Dependencies. Babies Exercise 2.2.5: At a birth, there is one baby (twins would be represented by two births), one mother, any number of nurses,
© D. Wong Functional Dependencies (FD)  Given: relation schema R(A1, …, An), and X and Y be subsets of (A1, … An). FD : X  Y means X functionally.
Advanced Database System
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Database Design and Programming Jan Baumbach Adopted from previous slides of Peter Schneider-Kamp.
Lecture 11: Functional Dependencies
CS 440 Database Management Systems
Design Theory for RDB Normal Forms.
Schedule Today: Next After that Normal Forms. Section 3.6.
Higher Forms of Normalization
CS411 Database Systems 08: Midterm Review Kazuhiro Minami 1.
Problem Axiom of addition:
CPSC-310 Database Systems
CS411 Database Systems 08: Midterm Review Kazuhiro Minami 1.
The Closure of a set of Attributes
Chapter 8: Relational Database Design
3.1 Functional Dependencies
Handout 4 Functional Dependencies
Schema Refinement & Normalization Theory
Problems in Designing Schema
Module 5: Overview of Normalization
Normalization Murali Mani.
Functional Dependencies and Normalization
How to test Whether Subschemes in BCNF??
Multivalued Dependencies & Fourth Normal Form (4NF)
Functional Dependencies and Normalization
Cse 344 May 16th – Normalization.
Functional Dependencies and Relational Schema Design
Multivalued Dependencies & Fourth Normal Form
Multivalued Dependencies & Fourth Normal Form
Relational Data Base Design in Practice
Normalization Part II cs3431.
Lecture 8: Database Design
Lecture 19a The Chase Test for Lossless Join
Instructor: Mohamed Eltabakh
II. Analyzing Arguments
Relational Database Design
Chapter 19 (part 1) Functional Dependencies
Functional Dependencies
Relational Database Design
Multivalued Dependencies
Lecture 6: Functional Dependencies
Chapter 3: Multivalued Dependencies
Chapter 3: Design theory for relational Databases
Chapter 7a: Overview of Database Design -- Normalization
Objectives Apply SSS to construct triangles and solve problems.
CS4222 Principles of Database System
Presentation transcript:

Exercise 3.6.1 R(A,B,C,D) with FD’s ABC, CD, and DA Indicate all the BCNF violations. Do not forget to consider FD’s that are not in the given set, but follow from them.

Babies Exercise 2.2.5: At a birth, there is one baby (twins would be represented by two births), one mother, any number of nurses, and any number of doctors. Suppose, therefore, that we have entity sets Babies, Mothers, Nurses, and Doctors. Suppose we also use a relationship Births, which connects these four entity sets. Note that a tuple of the relationship set for Births has the form (baby, mother, nurse, doctor)

Babies (Cont’ed) There are certain assumptions that we might wish to incorporate into our design. For each, tell how to add arrows or other elements to the E/R diagram in order to express the assumption. a) For every baby, there is a unique mother. c) For every combination of a baby and a mother there is a unique doctor.

Recovering Info from a Decomposition Why a decomposition based on an FD preserves the information of the original relation? Because: The projections of the original tuples can be “joined” again to produce all and only the original tuples. Example: Consider R(A, B, C) and FD BC, which suppose is a BCNF violation. Let’s decompose based on BC: R1(A,B) and R2(B,C). Let (a,b,c) be a tuple of R, that projects as (a,b) for R1, and as (b,c) for R2. It is possible to join a tuple from R1 with a tuple from R2, when they agree on the B component. In particular, (a,b) joins with (b,c) to give us the original tuple (a,b,c) back again. Getting back those tuples we started with is not enough. Do we also get false tuples, i.e. that weren’t in the original relation?

Example continued What might happen if there were two tuples of R, say (a,b,c) and (d,b,e)? We get: (a,b) and (d,b) in R1 (b,c) and (b,e) in R2 Now if we join R1 with R2 we get: (a,b,c) (d,b,e) (a,b,e) (is it bogus?) (d,b,c) (is it bogus?) They aren’t bogus. By the FD BC we know that if two tuples agree on B, they must agree on C as well. Hence c=e and we have: (a,b,e) = (a,b,c) (d,b,c) = (d,b,e)

What if BC wasn’t a true FD? Suppose R consists of two tuples: A B C 1 2 3 4 2 5 The projection of R onto the relations with schemas R1(A,B) and R2(B,C) are: A B and B C 1 2 2 3 4 2 2 5 Since all four tuples share the same B-value, 2, each tuple of one relation joins with both tuples of the other relation. Thus, when we try to reconstruct R by joining, we get: A B C 1 2 3 1 2 5 4 2 3 4 2 5 That is, we get “too much.”