zone# Garbage_Truck ships_to Garbage_Structure structid max_age

Size: px
Start display at page:

Download "zone# Garbage_Truck ships_to Garbage_Structure structid max_age"

Transcription

1 B561 Assignment 2 Solutions C.M. Wyss September 19, Questions a-c (below) concern the ER diagram in gure 1 (below). truckid driver zone# Garbage_Truck services Zone ships_to structid Garbage_Structure max_age type curr_age Figure 1: ER diagram for question 1. This ER diagram may be translated into the following tables: zone/ships to(zone#, structid) truck/services(truckid, zone#, driver) garbage structure(structid, type, curr age, max age) In addition, suppose that the functional dependencies F = f driver! truckid, type! max age, zone#! truckid, zone#! structid g hold. (a) Decompose the tables given above into a set of tables that are in BCNF with respect to the FDs in F. Make sure that you indicate primary keys and that these are minimal (given F ). 1

2 Solution: zone/ships to(zone#, structid) truck(truckid, driver) services(zone#, truckid) garbage structure(structid, type, curr age) structure max ages(type, max age) (b) Your BCNF decomposition (from part (a)) may contain remaining redundancies that indicate aws in the design of the original ER diagram. Use the techniques in your text to eliminate any remaining redundancy in your tabular representation. For example, if two tables have the same primary key, you may consider merging them. Make sure you indicate primary keys for your new tables. Solution: The tables zone/ships to and services have the same key, so we'll merge them. zone/ships to/services(zone#, structid, truckid) truck(truckid, driver) garbage structure(structid, type, curr age) structure max ages(type, max age) (c) Give an ER diagram that corresponds to the tables you obtained in part (b). Make sure you capture any new relationships that arise naturally in your new design so that, in particular, the information contained in the old design is completely recoverable. Solution: The merged table zone/ships to/services indicates we should use a ternary relationship instead of two binary relationships. Also, note that now that we have split garbage structures into two entities, we must capture the fact that structures are associated with a maximum age. Thus, we introduce a new relationship ("has max age") for this. The resulting modied diagram appears in gure 2. truckid driver zone# Garbage_Truck services/ ships_to Zone Garbage_Structure has_max_age Structure Max_Ages structid curr_age type max_age type Figure 2: Modied ER diagram for question 1, part (c). 2

3 2. Prove that the decomposition R(A; B; C; D), S(C; D; E; F), T (E; F; G; H) is in BCNF with respect to the set of FDs F = fg! B;AB! D; DE! C; FG! H; DB! E;AH! F; CE! A; AD! H; FG! Dg. Solution: We must show the BCNF property for each of R, S, and T. R: The only non-trivial FD that holds on R is AB! D. We must therefore show that AB is a key for R, i.e. that AB! C. We use Armstrong's axioms as follows. FD deduced 1 AB! D 2 F 2 AB! DB augmentation on 1 3 DB! E 2 F 4 AB! E transitivity on2 and 3 5 AB! DE union on 1 and 4 6 DE! C 2 F 7 AB! C transitivity on5 and 6 S: The only non-trivial FD that holds on S is DE! C. We must therefore show that DE is a key for S, i.e. that DE! F. We use Armstrong's axioms as follows. FD deduced 1 DE! C 2 F 2 AH! F 2 F 3 DE! CE augmentation on 1 4 CE! A 2 F 5 DE! A transitivity on3and4 6 DE! AD augmentation on 5 7 AD! H 2 F 8 DE! H transitivity on6and7 9 DE! AH union on 5and8 10 DE! F transitivity on2and9 T : The only non-trivial FD that holds on T is FG! H. We must therefore show that F G is a key for T, i.e. that F G! E. We use Armstrong's axioms as follows. FD deduced 1 FG! H 2 F 2 FG! D 2 F 3 G! B 2 F 4 FG! G decomposition on 2 5 FG! B transitivity on3 and 4 6 FG! DB union on 2 and 5 7 DB! E 2 F 8 FG! E transitivity on6 and 7 3

4 3. Consider the relation schema R(A; B; C; D; E; F; G; H) and set of FDs F = fa! D; DC! A; AH! F; FG! H; G! B;DE! Cg that hold in instances of R. (a) Find a decomposition of R that is in BCNF with respect to F. Solution: We use the decomposition method given in class (as part of the decomposition theorem). This is illustrated in gure 3. The nal decomposition is R 1 (A; D), R 2 (A; C), R 3 (F; G; H), R 4 (C; D; E), R 5 (B;G), and R 6 (D; E; F; G). R(A,B,C,D,E,F,G,H) DC > A R (A,C,D) * A > D R 1(A,D) R 2(A,C) R 3(F,G,H) R (B,C,D,E,F,G,H) FG > H R (B,C,D,E,F,G) DE > C R 4(C,D,E) R (B,D,E,F,G) G > B R 5(B,G) R (D,E,F,G) 6 Figure 3: BCNF decomposition. (b) Is your decomposition from part (a) lossless? Prove your answer. Solution: The decomposition is lossless due to the decomposition theorem. (c) Is your decomposition from part (a) dependency preserving? Prove your answer. Solution: The decomposition is not dependency preserving; for example, the dependency AH! F has been lost. To see this, note that AH! F is not derivable from the other FDs if F, and also it does not hold on any of the decomposed relations. (d) Find a decomposition of R that is in 3NF with respect to F, but is not in BCNF with respect to F. Solution: There are many such decompositions. One is R 1 (A; C; D), R 2 (F; G; H), R 3 (C; D; E), R 4 (B;G) and R 5 (D; E; F; G). Note, for example, that R 1 is not in BCNF since the FD A! D holds on R 1 but A is not a key for R 1 (since A 6! C). On the other hand, DC isakey for R 1, so D is part of the key DC for R 1. (e) Is your decomposition from part (c) lossless? Prove your answer. Solution: The decomposition is obtained by using the method for nding a BCNF decomposition for R (part (a)), however the step labelled * in gure 3 is 4

5 not included. Still, by the decomposition theorem, the decomposition is lossless, as for part (b). (f) Is your decomposition from part (c) dependency preserving? Prove your answer. Solution: The decomposition does not capture the dependency AH! F, as in part (c). 4. Do the following exercises from question 4.2 in your text: (d), (e), (f), (g). Solution: Given: two relations, R 1 and R 2 where jr 1 j = N 1 and jr 2 j = N 2 and N 1 >N 2 > 0. (a) Assume schema(r 1 ) =schema(r 2 ). Then N 1 jr 1 [ R 2 jn 1 + N 2. (b) Again assume schema(r 1 ) = schema(r 2 ). Then 0 jr 1 \ R 2 jn 2. (c) Again assume schema(r 1 ) = schema(r 2 ). Then N 1, N 2 jr 1, R 2 jn 1. (d) Assume schema(r 1 ) \ schema(r 2 )=;. Then jr 1 R 2 j = N 1 N 2. (e) Assume A 2 schema(r 1 ). Then 0 j A=5(R 1 )jn 1. (f) Assume A 2 schema(r 1 ). Then 1 j A (R 1 )jn 1. (g) Assume schema(r 1 )=fa; Bg and schema(r 2 )=fbg. Then 0 jr 1 =R 2 jn Given the relation schemas R(A; B; C), S(A; B; C), T (C; D; E) andu(c; D; E), prove (from rst principles) or disprove (using a counterexample) the following relational algebra (RA) identities. (a) (R./T)./ (S./ U) (R./S)./ (T./ U). Solution: True. Proof that ha; b; c; d; ei 2 (R./ T )./ (S./ U) implies ha; b; c; d; ei 2(R./S)./ (T./ U) follows. fact deduced 1 ha; b; c; d; ei 2(R./T)./ (S./ U) assumption 2 ha; b; c; d; ei 2R./T follows from 1 3 ha; b; c; d; ei 2S./ U follows from 1 4 ha; b; ci 2R follows from 2 5 hc; d; ei 2T follows from 2 6 ha; b; ci 2S follows from 3 7 hc; d; ei 2U follows from 3 8 ha; b; ci 2R./S follows from 4and6 9 hc; d; ei 2T./ U follows from 5and7 10 ha; b; c; d; ei 2(R./S)./ (T./ U) follows from 8and9 (b) (R./T)./ (S./ U) (R./S)./ (T./ U). Solution: True. Proof that ha; b; c; d; ei 2 (R./ S)./ (T./ U) implies ha; b; c; d; ei 2(R./T)./ (S./ U) follows. 5

6 fact deduced 1 ha; b; c; d; ei 2(R./S)./ (T./ U) assumption 2 ha; b; ci 2R./S follows from 1 3 hc; d; ei 2T./ U follows from 1 4 ha; b; ci 2R follows from 2 5 ha; b; ci 2S follows from 2 6 hc; d; ei 2T follows from 3 7 hc; d; ei 2U follows from 3 8 ha; b; c; d; ei 2R./T follows from 4and6 9 ha; b; c; d; ei 2S./ U follows from 5and7 10 ha; b; c; d; ei 2(R./T)./ (S./ U) follows from 8and9 (c) C (R./T)./ C (S./ U) C ((R./S)./ (T./ U)). Solution: False. Counterexample follows. R: a 1 b 1 c S: a 2 b 2 c T: c d 1 e 1 U: c d 2 e 2 For this counterexample, hci 2 C (R./ T )./ C (S./ U) but C ((R./ S)./ (T./ U)) = ;. (d) C (R./T)./ C (S./ U) C ((R./S)./ (T./ U)). Solution: True. Proof that hci 2 C ((R./S)./ (T./ U)) implies hci 2 C (R./ T )./ C (S./ U) follows. fact deduced 1 hci 2 C ((R./S)./ (T./ U)) assumption 2 hci 2 C ((R./T)./ (S./ U)) by part (b) 3 9a; b; d; e such that ha; b; c; d; ei 2(R./T)./ (S./ U) follows from 2 4 ha; b; c; d; ei 2R./T follows from 3 5 ha; b; c; d; ei 2S./ U follows from 3 6 hci 2 C (R./T) follows from 4 7 hci 2 C (S./ U) follows from 5 8 hci 2 C (R./T)./ C (S./ U) follows from 6 and 7 (e) (R, S)./ (T, U) (R./T), (S./ U). Solution: True. Proof that ha; b; c; d; ei 2(R,S)./ (T,U) implies ha; b; c; d; ei 2 (R./T), (S./ U) follows. 6

7 fact deduced 1 ha; b; c; d; ei 2(R, S)./ (T, U) assumption 2 ha; b; ci 2R, S follows from 1 3 hc; d; ei 2T, U follows from 1 4 ha; b; ci 2R follows from 2 5 ha; b; ci 62S follows from 2 6 hc; d; ei 2T follows from 3 7 hc; d; ei 62U follows from 3 8 ha; b; c; d; ei 2R./T follows from 4 and 6 9 ha; b; c; d; ei 62S./ U follows from 5 and 7 10 ha; b; c; d; ei 2(R./T),(S./ U) follows from 9 and 10 (f) (R, S)./ (T, U) (R./T), (S./ U). Solution: False. Counterexample follows. R: a b c S: a 0 b 0 c 0 T: c d e U: c d e For this counterexample, ha; b; c; d; ei 2 (R./ T ), (S./ U) but (R, S)./ (T, U) =;. 7

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

UVA UVA UVA UVA. Database Design. Relational Database Design. Functional Dependency. Loss of Information Relational Database Design Database Design To generate a set of relation schemas that allows - to store information without unnecessary redundancy - to retrieve desired information easily Approach - design

More information

Relational Database Design

Relational Database Design Relational Database Design Jan Chomicki University at Buffalo Jan Chomicki () Relational database design 1 / 16 Outline 1 Functional dependencies 2 Normal forms 3 Multivalued dependencies Jan Chomicki

More information

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

Consider a relation R with attributes ABCDEF GH and functional dependencies S: University of Toronto CSC343 Sample 3NF Problem Questions Consider a relation R with attributes ABCDEF GH and functional dependencies S: S = {A CD, ACF G, AD BEF, BCG D, CF AH, CH G, D B, H DEG} 1. Compute

More information

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

Introduction. Normalization. Example. Redundancy. What problems are caused by redundancy? What are functional dependencies? Normalization Introduction What problems are caused by redundancy? UVic C SC 370 Dr. Daniel M. German Department of Computer Science What are functional dependencies? What are normal forms? What are the

More information

Schema Refinement: Other Dependencies and Higher Normal Forms

Schema Refinement: Other Dependencies and Higher Normal Forms 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

More information

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

Review: Keys. What is a Functional Dependency? Why use Functional Dependencies? Functional Dependency Properties Review: Keys Superkey: set of attributes whose values are unique for each tuple Note: a superkey isn t necessarily minimal. For example, for any relation, the entire set of attributes is always a superkey.

More information

Relational Design: Characteristics of Well-designed DB

Relational Design: Characteristics of Well-designed DB Relational Design: Characteristics of Well-designed DB 1. Minimal duplication Consider table newfaculty (Result of F aculty T each Course) Id Lname Off Bldg Phone Salary Numb Dept Lvl MaxSz 20000 Cotts

More information

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

FUNCTIONAL DEPENDENCY THEORY. CS121: Relational Databases Fall 2017 Lecture 19 FUNCTIONAL DEPENDENCY THEORY CS121: Relational Databases Fall 2017 Lecture 19 Last Lecture 2 Normal forms specify good schema patterns First normal form (1NF): All attributes must be atomic Easy in relational

More information

Normal Forms Lossless Join.

Normal Forms Lossless Join. Normal Forms Lossless Join http://users.encs.concordia.ca/~m_oran/ 1 Types of Normal Forms A relation schema R is in the first normal form (1NF) if the domain of its each attribute has only atomic values

More information

SCHEMA NORMALIZATION. CS 564- Fall 2015

SCHEMA NORMALIZATION. CS 564- Fall 2015 SCHEMA NORMALIZATION CS 564- Fall 2015 HOW TO BUILD A DB APPLICATION Pick an application Figure out what to model (ER model) Output: ER diagram Transform the ER diagram to a relational schema Refine the

More information

Lossless Joins, Third Normal Form

Lossless Joins, Third Normal Form Lossless Joins, Third Normal Form FCDB 3.4 3.5 Dr. Chris Mayfield Department of Computer Science James Madison University Mar 19, 2018 Decomposition wish list 1. Eliminate redundancy and anomalies 2. Recover

More information

Chapter 11, 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 Normal forms are insufficient on their own as a criteria for a good relational database schema design. The relations in a database

More information

Schema Refinement and Normal Forms. Why schema refinement?

Schema Refinement and Normal Forms. Why schema refinement? Schema Refinement and Normal Forms Why schema refinement? Consider relation obtained from Hourly_Emps: Hourly_Emps (sin,rating,hourly_wages,hourly_worked) Problems: Update Anomaly: Can we change the wages

More information

CS54100: Database Systems

CS54100: Database Systems CS54100: Database Systems Keys and Dependencies 18 January 2012 Prof. Chris Clifton Functional Dependencies X A = assertion about a relation R that whenever two tuples agree on all the attributes of X,

More information

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

Consider a relation R with attributes ABCDEF GH and functional dependencies S: University of Toronto CSC343 Sample 3NF Problem Questions Consider a relation R with attributes ABCDEF GH and functional dependencies S: 1. Compute all keys for R. S = {A CD, ACF G, AD BEF, BCG D, CF AH,

More information

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

Information Systems for Engineers. Exercise 8. ETH Zurich, Fall Semester Hand-out Due Information Systems for Engineers Exercise 8 ETH Zurich, Fall Semester 2017 Hand-out 24.11.2017 Due 01.12.2017 1. (Exercise 3.3.1 in [1]) For each of the following relation schemas and sets of FD s, i)

More information

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

But RECAP. Why is losslessness important? An Instance of Relation NEWS. Suppose we decompose NEWS into: R1(S#, Sname) R2(City, Status) So far we have seen: RECAP How to use functional dependencies to guide the design of relations How to modify/decompose relations to achieve 1NF, 2NF and 3NF relations But How do we make sure the decompositions

More information

Functional Dependencies & Normalization. Dr. Bassam Hammo

Functional Dependencies & Normalization. Dr. Bassam Hammo Functional Dependencies & Normalization Dr. Bassam Hammo Redundancy and Normalisation Redundant Data Can be determined from other data in the database Leads to various problems INSERT anomalies UPDATE

More information

Normaliza)on and Func)onal Dependencies

Normaliza)on and Func)onal Dependencies Normaliza)on and Func)onal Dependencies 1NF and 2NF Redundancy and Anomalies Func)onal Dependencies A9ribute Closure Keys and Super keys 3NF BCNF Minimal Cover Algorithm 3NF Synthesis Algorithm Decomposi)on

More information

DECOMPOSITION & SCHEMA NORMALIZATION

DECOMPOSITION & SCHEMA NORMALIZATION DECOMPOSITION & SCHEMA NORMALIZATION CS 564- Spring 2018 ACKs: Dan Suciu, Jignesh Patel, AnHai Doan WHAT IS THIS LECTURE ABOUT? Bad schemas lead to redundancy To correct bad schemas: decompose relations

More information

CSC 261/461 Database Systems Lecture 13. Spring 2018

CSC 261/461 Database Systems Lecture 13. Spring 2018 CSC 261/461 Database Systems Lecture 13 Spring 2018 BCNF Decomposition Algorithm BCNFDecomp(R): Find X s.t.: X + X and X + [all attributes] if (not found) then Return R let Y = X + - X, Z = (X + ) C decompose

More information

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

Background: Functional Dependencies. æ We are always talking about a relation R, with a æxed schema èset of attributesè and a Background: Functional Dependencies We are always talking about a relation R, with a xed schema èset of attributesè and a varying instance èset of tuplesè. Conventions: A;B;:::are attributes; :::;Y;Z are

More information

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

A few details using Armstrong s axioms. Supplement to Normalization Lecture Lois Delcambre A few details using Armstrong s axioms Supplement to Normalization Lecture Lois Delcambre 1 Armstrong s Axioms with explanation and examples Reflexivity: If X Y, then X Y. (identity function is a function)

More information

Functional Dependencies

Functional Dependencies Functional Dependencies P.J. M c.brien Imperial College London P.J. M c.brien (Imperial College London) Functional Dependencies 1 / 41 Problems in Schemas What is wrong with this schema? bank data no sortcode

More information

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

Functional Dependencies. Applied Databases. Not all designs are equally good! An example of the bad design Applied Databases Handout 2a. Functional Dependencies and Normal Forms 20 Oct 2008 Functional Dependencies This is the most mathematical part of the course. Functional dependencies provide an alternative

More information

Design theory for relational databases

Design theory for relational databases Design theory for relational databases 1. Consider a relation with schema R(A,B,C,D) and FD s AB C, C D and D A. a. What are all the nontrivial FD s that follow from the given FD s? You should restrict

More information

Information Systems (Informationssysteme)

Information Systems (Informationssysteme) Information Systems (Informationssysteme) Jens Teubner, TU Dortmund jens.teubner@cs.tu-dortmund.de Summer 2015 c Jens Teubner Information Systems Summer 2015 1 Part VII Schema Normalization c Jens Teubner

More information

Chapter 3 Design Theory for Relational Databases

Chapter 3 Design Theory for Relational Databases 1 Chapter 3 Design Theory for Relational Databases Contents Functional Dependencies Decompositions Normal Forms (BCNF, 3NF) Multivalued Dependencies (and 4NF) Reasoning About FD s + MVD s 2 Remember our

More information

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. The Evils of Redundancy. Functional Dependencies (FDs) CIS 330, Spring 2004 Lecture 11 March 2, 2004 Schema Refinement and Normal Forms CIS 330, Spring 2004 Lecture 11 March 2, 2004 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational schemas: redundant storage,

More information

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

Databases Lecture 8. Timothy G. Griffin. Computer Laboratory University of Cambridge, UK. Databases, Lent 2009 Databases Lecture 8 Timothy G. Griffin Computer Laboratory University of Cambridge, UK Databases, Lent 2009 T. Griffin (cl.cam.ac.uk) Databases Lecture 8 DB 2009 1 / 15 Lecture 08: Multivalued Dependencies

More information

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

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1 Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1 Background We started with schema design ER model translation into a relational schema Then we studied relational

More information

Schema Refinement & Normalization Theory

Schema Refinement & Normalization Theory Schema Refinement & Normalization Theory Functional Dependencies Week 13 1 What s the Problem Consider relation obtained (call it SNLRHW) Hourly_Emps(ssn, name, lot, rating, hrly_wage, hrs_worked) What

More information

Functional Dependency and Algorithmic Decomposition

Functional Dependency and Algorithmic Decomposition Functional Dependency and Algorithmic Decomposition In this section we introduce some new mathematical concepts relating to functional dependency and, along the way, show their practical use in relational

More information

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

Normal Forms. Dr Paolo Guagliardo. University of Edinburgh. Fall 2016 Normal Forms Dr Paolo Guagliardo University of Edinburgh Fall 2016 Example of bad design BAD Title Director Theatre Address Time Price Inferno Ron Howard Vue Omni Centre 20:00 11.50 Inferno Ron Howard

More information

Relational-Database Design

Relational-Database Design C H A P T E R 7 Relational-Database Design Exercises 7.2 Answer: A decomposition {R 1, R 2 } is a lossless-join decomposition if R 1 R 2 R 1 or R 1 R 2 R 2. Let R 1 =(A, B, C), R 2 =(A, D, E), and R 1

More information

Constraints: Functional Dependencies

Constraints: Functional Dependencies Constraints: Functional Dependencies Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Functional Dependencies 1 / 32 Schema Design When we get a relational

More information

Schema Refinement and Normalization

Schema Refinement and Normalization Schema Refinement and Normalization Schema Refinements and FDs Redundancy is at the root of several problems associated with relational schemas. redundant storage, I/D/U anomalies Integrity constraints,

More information

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

COSC 430 Advanced Database Topics. Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago COSC 430 Advanced Database Topics Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago Learning objectives and references You should be able to: define the elements of the relational

More information

Desirable properties of decompositions 1. Decomposition of relational schemes. Desirable properties of decompositions 3

Desirable properties of decompositions 1. Decomposition of relational schemes. Desirable properties of decompositions 3 Desirable properties of decompositions 1 Lossless decompositions A decomposition of the relation scheme R into Decomposition of relational schemes subschemes R 1, R 2,..., R n is lossless if, given tuples

More information

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

Functional Dependencies. Getting a good DB design Lisa Ball November 2012 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

More information

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

Normalization. October 5, Chapter 19. CS445 Pacific University 1 10/05/17 Normalization October 5, 2017 Chapter 19 Pacific University 1 Description A Real Estate agent wants to track offers made on properties. Each customer has a first and last name. Each property has a size,

More information

Constraints: Functional Dependencies

Constraints: Functional Dependencies Constraints: Functional Dependencies Fall 2017 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Functional Dependencies 1 / 42 Schema Design When we get a relational

More information

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

Relational Design Theory I. Functional Dependencies: why? Redundancy and Anomalies I. Functional Dependencies Relational Design Theory I Functional Dependencies Functional Dependencies: why? Design methodologies: Bottom up (e.g. binary relational model) Top-down (e.g. ER leads to this) Needed: tools for analysis

More information

Relational Database Design

Relational Database Design CSL 451 Introduction to Database Systems Relational Database Design Department of Computer Science and Engineering Indian Institute of Technology Ropar Narayanan (CK) Chatapuram Krishnan! Recap - Boyce-Codd

More information

Schema Refinement. Feb 4, 2010

Schema Refinement. Feb 4, 2010 Schema Refinement Feb 4, 2010 1 Relational Schema Design Conceptual Design name Product buys Person price name ssn ER Model Logical design Relational Schema plus Integrity Constraints Schema Refinement

More information

Relational Design Theory

Relational Design Theory Relational Design Theory CSE462 Database Concepts Demian Lessa/Jan Chomicki Department of Computer Science and Engineering State University of New York, Buffalo Fall 2013 Overview How does one design a

More information

Chapter 7: Relational Database Design

Chapter 7: Relational Database Design Chapter 7: Relational Database Design Chapter 7: Relational Database Design! First Normal Form! Pitfalls in Relational Database Design! Functional Dependencies! Decomposition! Boyce-Codd Normal Form! Third

More information

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

Chapter 7: Relational Database Design. Chapter 7: Relational Database Design Chapter 7: Relational Database Design Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design Functional Dependencies Decomposition Boyce-Codd Normal Form Third Normal

More information

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

Relational Database Design Theory Part II. Announcements (October 12) Review. CPS 116 Introduction to Database Systems Relational Database Design Theory Part II CPS 116 Introduction to Database Systems Announcements (October 12) 2 Midterm graded; sample solution available Please verify your grades on Blackboard Project

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms Chapter 19 Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational

More information

Schema Refinement and Normal Forms. Chapter 19

Schema Refinement and Normal Forms. Chapter 19 Schema Refinement and Normal Forms Chapter 19 1 Review: Database Design Requirements Analysis user needs; what must the database do? Conceptual Design high level descr. (often done w/er model) Logical

More information

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

Database Design: Normal Forms as Quality Criteria. Functional Dependencies Normal Forms Design and Normal forms Database Design: Normal Forms as Quality Criteria Functional Dependencies Normal Forms Design and Normal forms Design Quality: Introduction Good conceptual model: - Many alternatives - Informal guidelines

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms Chapter 19 Quiz #2 Next Thursday Comp 521 Files and Databases Fall 2012 1 The Evils of Redundancy v Redundancy is at the root of several problems associated with relational

More information

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

The Evils of Redundancy. Schema Refinement and Normal Forms. Functional Dependencies (FDs) Example: Constraints on Entity Set. Example (Contd. The Evils of Redundancy Schema Refinement and Normal Forms INFO 330, Fall 2006 1 Redundancy is at the root of several problems associated with relational schemas: redundant storage, insert/delete/update

More information

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

10/12/10. Outline. Schema Refinements = Normal Forms. First Normal Form (1NF) Data Anomalies. Relational Schema Design Outline Introduction to Database Systems CSE 444 Design theory: 3.1-3.4 [Old edition: 3.4-3.6] Lectures 6-7: Database Design 1 2 Schema Refinements = Normal Forms 1st Normal Form = all tables are flat

More information

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

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) [R&G] Chapter 19 Schema Refinement and Normal Forms [R&G] Chapter 19 CS432 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational schemas: redundant storage, insert/delete/update

More information

Database Design and Implementation

Database Design and Implementation Database Design and Implementation CS 645 Schema Refinement First Normal Form (1NF) A schema is in 1NF if all tables are flat Student Name GPA Course Student Name GPA Alice 3.8 Bob 3.7 Carol 3.9 Alice

More information

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

Design Theory for Relational Databases. Spring 2011 Instructor: Hassan Khosravi Design Theory for Relational Databases Spring 2011 Instructor: Hassan Khosravi Chapter 3: Design Theory for Relational Database 3.1 Functional Dependencies 3.2 Rules About Functional Dependencies 3.3 Design

More information

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) Example (Contd. The Evils of Redundancy Schema Refinement and Normal Forms Chapter 19 Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke 1 Redundancy is at the root of several problems associated with relational

More information

Kapitel 3: Formal Design

Kapitel 3: Formal Design Theory I: Database Foundations 3. Formal Design 3. Kapitel 3: Formal Design We want to distinguish good from bad database design. What kind of additional information do we need? Can we transform a bad

More information

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

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 Chapter 19 Database Management Systems, R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms UMass Amherst Feb 14, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke, Dan Suciu 1 Relational Schema Design Conceptual Design name Product buys Person price name

More information

CSIT5300: Advanced Database Systems

CSIT5300: Advanced Database Systems CSIT5300: Advanced Database Systems L05: Functional Dependencies Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong SAR, China

More information

Chapter 8: Relational Database Design

Chapter 8: Relational Database Design Chapter 8: Relational Database Design Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 8: Relational Database Design Features of Good Relational Design Atomic Domains

More information

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

DESIGN THEORY FOR RELATIONAL DATABASES. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018 DESIGN THEORY FOR RELATIONAL DATABASES csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018 1 Introduction There are always many different schemas for a given

More information

Functional Dependencies

Functional Dependencies Functional Dependencies Functional Dependencies Framework for systematic design and optimization of relational schemas Generalization over the notion of Keys Crucial in obtaining correct normalized schemas

More information

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

Schema Refinement and Normal Forms. The Evils of Redundancy. Schema Refinement. Yanlei Diao UMass Amherst April 10, 2007 Schema Refinement and Normal Forms Yanlei Diao UMass Amherst April 10, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated

More information

Database Design and Normalization

Database Design and Normalization Database Design and Normalization Chapter 11 (Week 12) EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 1 1NF FIRST S# Status City P# Qty S1 20 London P1 300 S1 20 London

More information

Homework 2 (by Prashasthi Prabhakar) Solutions Due: Wednesday Sep 20, 11:59pm

Homework 2 (by Prashasthi Prabhakar) Solutions Due: Wednesday Sep 20, 11:59pm CARNEGIE MELLON UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE 15-445/645 DATABASE SYSTEMS (FALL 2017) PROF. ANDY PAVLO Homework 2 (by Prashasthi Prabhakar) Solutions Due: Wednesday Sep 20, 2017 @ 11:59pm IMPORTANT:

More information

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

The Evils of Redundancy. Schema Refinement and Normalization. Functional Dependencies (FDs) Example: Constraints on Entity Set. Refining an ER Diagram The Evils of Redundancy Schema Refinement and Normalization Chapter 1 Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus Redundancy is at the root of several problems

More information

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

Normal Forms (ii) ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa ICS 321 Fall 2012 Normal Forms (ii) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/12/2012 Lipyeow Lim -- University of Hawaii at Manoa 1 Hourly_Emps

More information

Design Theory for Relational Databases

Design Theory for Relational Databases Design Theory for Relational Databases FUNCTIONAL DEPENDENCIES DECOMPOSITIONS NORMAL FORMS 1 Functional Dependencies X ->Y is an assertion about a relation R that whenever two tuples of R agree on all

More information

Functional Dependencies and Normalization

Functional Dependencies and Normalization Functional Dependencies and Normalization There are many forms of constraints on relational database schemata other than key dependencies. Undoubtedly most important is the functional dependency. A functional

More information

Lecture 6 Relational Database Design

Lecture 6 Relational Database Design Lecture 6 Relational Database Design Shuigeng Zhou October 21/27, 2009 School of Computer Science Fudan University Relational Database Design First Normal Form Pitfalls in Relational Database Design Functional

More information

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

Shuigeng Zhou. April 6/13, 2016 School of Computer Science Fudan University Lecture 6 Relational Database Design Shuigeng Zhou April 6/13, 2016 School of Computer Science Fudan University Relational Database Design p First Normal Form p Pitfalls in Relational Database Design p

More information

Schema Refinement and Normal Forms Chapter 19

Schema Refinement and Normal Forms Chapter 19 Schema Refinement and Normal Forms Chapter 19 Instructor: Vladimir Zadorozhny vladimir@sis.pitt.edu Information Science Program School of Information Sciences, University of Pittsburgh Database Management

More information

Homework 2 (by Prashasthi Prabhakar) Due: Wednesday Sep 20, 11:59pm

Homework 2 (by Prashasthi Prabhakar) Due: Wednesday Sep 20, 11:59pm CARNEGIE MELLON UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE 15-445/645 DATABASE SYSTEMS (FALL 2017) PROF. ANDY PAVLO Homework 2 (by Prashasthi Prabhakar) Due: Wednesday Sep 20, 2017 @ 11:59pm IMPORTANT:

More information

HKBU: Tutorial 4

HKBU: Tutorial 4 COMP7640 @ HKBU: Tutorial 4 Functional Dependency and Database Normalization Wei Wang weiw AT cse.unsw.edu.au School of Computer Science & Engineering University of New South Wales October 17, 2014 Wei

More information

Problem about anomalies

Problem about anomalies Problem about anomalies Title Year Genre StarName Star Wars 1977 SciFi Carrie Fisher Star Wars 1977 SciFi Harrison Ford Raiders... 1981 Action Harrison Ford Raiders... 1981 Adventure Harrison Ford When

More information

Unit 3 - Functional Dependency and Decomposition

Unit 3 - Functional Dependency and Decomposition Functional Dependency Let R be a relation schema having n attributes A1, A2, A3,, An. Let attributes X and Y are two subsets of attributes of relation R. If the values of the X component of a tuple uniquely

More information

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

CMPT 354: Database System I. Lecture 9. Design Theory CMPT 354: Database System I Lecture 9. Design Theory 1 Design Theory Design theory is about how to represent your data to avoid anomalies. Design 1 Design 2 Student Course Room Mike 354 AQ3149 Mary 354

More information

Functional Dependency Theory II. Winter Lecture 21

Functional Dependency Theory II. Winter Lecture 21 Functional Dependency Theory II Winter 2006-2007 Lecture 21 Last Time Introduced Third Normal Form A weakened version of BCNF that preserves more functional dependencies Allows non-trivial dependencies

More information

Chapter 3 Design Theory for Relational Databases

Chapter 3 Design Theory for Relational Databases 1 Chapter 3 Design Theory for Relational Databases Contents Functional Dependencies Decompositions Normal Forms (BCNF, 3NF) Multivalued Dependencies (and 4NF) Reasoning About FD s + MVD s 2 Our example

More information

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

Chapter 10. Normalization Ext (from E&N and my editing) Chapter 10 Normalization Ext (from E&N and my editing) Outline BCNF Multivalued Dependencies and Fourth Normal Form 2 BCNF A relation schema R is in Boyce-Codd Normal Form (BCNF) if whenever an FD X ->

More information

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

Schema Refinement. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke Schema Refinement Yanlei Diao UMass Amherst Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Revisit a Previous Example ssn name Lot Employees rating hourly_wages hours_worked ISA contractid Hourly_Emps

More information

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. Case Study: The Internet Shop. Redundant Storage! Yanlei Diao UMass Amherst November 1 & 6, 2007 Schema Refinement and Normal Forms Yanlei Diao UMass Amherst November 1 & 6, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Case Study: The Internet Shop DBDudes Inc.: a well-known database consulting

More information

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

Relational Design Theory II. Detecting Anomalies. Normal Forms. Normalization Relational Design Theory II Normalization Detecting Anomalies SID Activity Fee Tax 1001 Piano $20 $2.00 1090 Swimming $15 $1.50 1001 Swimming $15 $1.50 Why is this bad design? Can we capture this using

More information

CSE 544 Principles of Database Management Systems

CSE 544 Principles of Database Management Systems CSE 544 Principles of Database Management Systems Lecture 3 Schema Normalization CSE 544 - Winter 2018 1 Announcements Project groups due on Friday First review due on Tuesday (makeup lecture) Run git

More information

Functional Dependencies

Functional Dependencies Cleveland State University CIS 611 Relational Databases Prepared by Victor Matos Functional Dependencies Source: The Theory of Relational Databases D. Maier, Ed. Computer Science Press Available at: http://www.dbis.informatik.hu-berlin.de/~freytag/maier/

More information

1 Selected Homework Solutions

1 Selected Homework Solutions Selected Homework Solutions Mathematics 4600 A. Bathi Kasturiarachi September 2006. Selected Solutions to HW # HW #: (.) 5, 7, 8, 0; (.2):, 2 ; (.4): ; (.5): 3 (.): #0 For each of the following subsets

More information

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

Data Bases Data Mining Foundations of databases: from functional dependencies to normal forms Data Bases Data Mining Foundations of databases: from functional dependencies to normal forms Database Group http://liris.cnrs.fr/ecoquery/dokuwiki/doku.php?id=enseignement: dbdm:start March 1, 2017 Exemple

More information

CSE 132B Database Systems Applications

CSE 132B Database Systems Applications CSE 132B Database Systems Applications Alin Deutsch Database Design and Normal Forms Some slides are based or modified from originals by Sergio Lifschitz @ PUC Rio, Brazil and Victor Vianu @ CSE UCSD and

More information

LOGICAL DATABASE DESIGN Part #1/2

LOGICAL DATABASE DESIGN Part #1/2 LOGICAL DATABASE DESIGN Part #1/2 Functional Dependencies Informally, a FD appears when the values of a set of attributes uniquely determines the values of another set of attributes. Example: schedule

More information

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

Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See   for conditions on re-use Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use " Features of Good Relational Design! Atomic Domains and First Normal Form! Decomposition

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms Yanlei Diao UMass Amherst April 10 & 15, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Case Study: The Internet Shop DBDudes Inc.: a well-known database consulting

More information

Practice and Applications of Data Management CMPSCI 345. Lecture 16: Schema Design and Normalization

Practice and Applications of Data Management CMPSCI 345. Lecture 16: Schema Design and Normalization Practice and Applications of Data Management CMPSCI 345 Lecture 16: Schema Design and Normalization Keys } A superkey is a set of a/ributes A 1,..., A n s.t. for any other a/ribute B, we have A 1,...,

More information

Comp 5311 Database Management Systems. 5. Functional Dependencies Exercises

Comp 5311 Database Management Systems. 5. Functional Dependencies Exercises Comp 5311 Database Management Systems 5. Functional Dependencies Exercises 1 Assume the following table contains the only set of tuples that may appear in a table R. Which of the following FDs hold in

More information

1. Binary Decomposition Approach: Considering R: Keys ={BEFG, CEFG, EFGH} F = {CD A, EC H, GHB AB, C D, EG A, H B, BE CD, EC B}

1. Binary Decomposition Approach: Considering R: Keys ={BEFG, CEFG, EFGH} F = {CD A, EC H, GHB AB, C D, EG A, H B, BE CD, EC B} Question 1: Consider R = {A, B, C, D, E, F, G, H} with set of FDs F = {CD A, EC H, GHB AB, C D, EG A, H B, BE CD, EC B} The cndidte keys re: {BEFG, CEFG, EFGH} Is R w.r.t. F in 3NF? If not decompose it

More information

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

Introduction to Data Management. Lecture #6 (Relational DB Design Theory) Introduction to Data Management Lecture #6 (Relational DB Design Theory) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Homework

More information

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

FUNCTIONAL DEPENDENCY THEORY II. CS121: Relational Databases Fall 2018 Lecture 20 FUNCTIONAL DEPENDENCY THEORY II CS121: Relational Databases Fall 2018 Lecture 20 Canonical Cover 2 A canonical cover F c for F is a set of functional dependencies such that: F logically implies all dependencies

More information