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

Size: px
Start display at page:

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

Transcription

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

2 Design Quality: Introduction Good conceptual model: - Many alternatives - Informal guidelines - Wanted: Formal methods for comparing designs Informal guidelines - Avoid redundancies e.g., Movie(id, category, ) and Tape(id, category, ) - Avoid modeling several real objects in one entity e.g., Movie_two_concepts(id, title, category, year, price_per_day, length, director, birthday, livesincity, ) - Make constraints explicit e.g. tape is loaned by zero or one customer 2

3 Design Quality: Anomalies by redundancy Deletion anomaly: Loss of information about data object by deletion of tuple Example: - consider Movie_two_concepts(id, title, category, year, price_per_day, length, director, birthday, livesincity, ) - deletion of tuple (95, 'Psycho', 'suspense', 1969, 2.00, NULL, 'Hitchcock', , NULL,...) if only-one movie of Hitchcock in database all information about director lost 3

4 Design Quality: Anomalies by redundancy Modification anomaly: Change of data object update all concerned tuples Example: - consider Movie_two_concepts(id, title, category, year, price_per_day, length, director, birthday, livesincity, ) - Spielberg moves to different city change all his movies 4

5 Design Quality: Anomalies by redundancy Insertion anomaly: Insert data consistent with existing tuples - Example: no varying in Hitchcock s birthday Insertion of single data object difficult - Example: insertion of new director without film impossible 5

6 Functional dependency: Introduction Important formal concept Formalizes constraints between attributes Constraints of modeled domain Will be used to formalize design rules Important concept Consider attribute sets X,Y R Functional dependency: X Y - Constraint on possible tuples of R - Tuples t1, t2 R: t1[x]=t2[x] t1[y]=t2[y] Function X Y - Not explicit 6

7 Functional Dependency: Examples Examples: - Attribute director determines attribute birthday = birthday is functionally determined by director = birthday is functionally dependent on director = director birthday - Attribute director does not determine attribute movie.title = director title - Attribute director determines attribute livesincity = director livesincity - director {birthday,livesincity} - birthday director 7

8 Functional Dependency: Key dependencies Consider R(A 1,A 2,A 3,A 4,,A n ) Then: {A 1,A 2,A 3 } {A 4,,A n } {A 1,A 2,A 3 } {A 4 },, {A 1,A 2,A 3 } {A n } Function maps keys to values of attributes Examples: - id {title, category, year, price_per_day, length, director, } - id {title, category, year, price_per_day} - id {title} 8

9 Functional Dependency: Key dependencies Dependencies on super- and candidate keys - Superkey: subset of attributes SK of relation R for which no two tuples have the same value SK R \ SK - Candidate key: superkey K of relation R such that if any attribute A K is removed, the set of attributes K\A is not superkey of R K R \ K Examples: - {id, title, director} {category, year,, length, birthday, } - {title, year} {id, category,, length, director, birthday, } - {director, year} {id, category, year,, length, birthday, } 9

10 Functional Dependency: Formal definition Functional dependency: Let R ={A 1, A 2,, A n } be attribute set of a relation R, t1, t2 tuples of R, and X, Y R Y is functionally dependent on X (X Y) ( x i X ) t1[x i ] = t2[x i ] ( y i Y ) t1[y i ]= t2[y i ] - Invariants must hold at all times - Independent of state of db 10

11 Functional Dependency: Example Consider: R(A,B,C,D) R A B C D a1 a1 a2 a2 a3 b1 b2 b2 b3 b3 c1 c1 c2 c2 c2 d1 d2 d2 d3 d4 Inferring FDs from representative table instance: - A C, A B, A D - B A, B C, B D - C A, C B, C D - AB C, AB D, AC B, AC D, 11

12 Functional Dependency: Example DB design: infer FDs from application semantics Example: Tape(id, format, movie_id) id format id movie_id Actor(stage_name, real_name, birthday) stage_name real_name stage_name birthday Rental(tape_id, member, from, until) {tape_id, member, from} until 12

13 Functional Dependency: Properties Consider: relation R, X,Y,Z attribute sets in R X Y trivial functional dependency if Y X e.g. AB A, A A X Y full functional dependency if - ( X Y ), and - Z X: Z Y Transitive functional dependency - Suppose X Y and Y Z - Then X Z (Z is transitively dependent on X) 13

14 Functional Dependency: Properties Consider: relation R, set of FDs F Closure of F: - Set of functional dependencies logically implied by F - Denoted by F + - F + = { X Y F X Y } Minimal cover: - Minimal set of functional dependencies for relation R 14

15 Functional Dependency: Closure Consider: set of FDs F, set of attributes A={A 1, A n } Computing closure of attributes: Initialize result:=a While(changes in result){ for each FD X Y in F{ if X in result then result = result Y } } Result: set of attributes A + with A A + 15

16 Functional Dependency: Example Consider R(A,B,C,D,E,F) F: {(1)AB C, (2)BC AD, (3)D E, (4)CF B} Find closure for {A,B}: - res:={a,b} - 1 st iteration: (1) res = res C, res={a,b,c} - 2 nd interation: (2) res = res AD, res={a,b,c,d} - 3 rd interation: (3) res = res E, res={a,b,c,d,e} Result: {AB} + = {A,B,C,D,E} 16

17 Functional Dependency: Armstrong's Axioms Reflexivity rule: If Y X then X Y Augmentation rule: If X Y and set of attributes Z then X Z Y Z Transitivity rule: If X Y and Y Z then X Z Complete rules: allow to generate all FDs in F + Sound rules: only logically implied FDs are produced 17

18 Functional Dependency: Additional rules Union rule: If X Y and X Z then X YZ - Proof: use Augmentation, Transitivity Decomposition rule: If X YZ then X Y and X Z Proof: use definition of FD Pseudotransitivity rule: If X Y and ZY T then ZX T Proof: use Augmentation, Transitivity 18

19 Functional Dependency: Example Consider R = (A, B, C, G, H, I) F: { A B, (1) (2) A C, (3) CG H, (4) CG I, (5) B H } (6) Some members of F + : A H [ (1),(6), Transitivity ] CG HI [ (4),(5), Union ] AG I [ (2),(5), Augmentation, Transitivity ] Candidate key: AG 19

20 Functional Dependency: Example Consider: Movie_two_concepts_noID(title, category, year, price_per_day, length, director, birthday, livesincity, ) Set of FDs F: {{title, director} category, {title, director} year, {title,director} price_per_day, {title,director} length, director birthday, director livesincity} More functional dependencies: Reflexivity: {title, director} director, Augmentation: {director, title} {birthday,title}, Transitivity: {title, director} birthday, 20

21 Functional Dependency: Minimal cover Consider: sets of dependencies F and G F and G equivalent if F + = G + (F covers G,G covers F) Minimal set of dependencies (Algorithm): 1. Every right side of a dependency in F is a single attribute (apply decomposition) 2. For no X Y in F is the set F { X Y } equivalent to F (all dependencies are useful) 3. For no X Y in F and Z X is F { X Y } { Z Y } equivalent to F (no attribute in any left side is redundant) 4. Every left side of FDs unique (apply union rule) 21

22 Functional Dependency: Example Find minimal cover: F: {AB C, C A, BC D, ACD B, D EG, BE C, CE AG, CG BD} 1. Split right sides: { AB C, C A, BC D, ACD B, D E, D G, BE C, CE A, CE G, CG B, CG D } 2. Delete unnecessary FDs: CE A redundant (C A). CG B redundant (CG D, C A and ACD B) 3. Minimal left sides: no changes 4. Unique left sides: {AB C, C A, BC D, ACD B, D EG, BE C, CE G, CG D } 22

23 Design Quality: Functional Dependencies Intuitive goal: - Find a set of relations which do not have "anomalies" - Algorithm producing relational schema from set of FDs Invariants - in application domain - made explicit during requirements analysis ER-design - First step - Refine afterwards - Good ER provides good design 23

24 Design Quality: Functional Dependencies Consider: Movie_two_concepts(id, title, category, year, price_per_day, length, director, birthday, livesincity, ) Example Dependencies: id {birthday, livesincity, } director {birthday, livesincity} Bad design: non-key dependency Key properties checked by DB system, other functional dependencies are not! e.g. different birthdays or cities for one director cannot be prevented by the DBS 24

25 Design Quality: Functional Dependencies Consider: Movie_two_concepts_noID(title, category, year, price_per_day, length, director, birthday, livesincity, ) Example Dependencies: {title, director} {birthday, livesincity, } director {birthday, livesincity} Bad design: partial-key dependency Key properties checked by DB system, other functional dependencies are not! e.g. different birthdays or cities for one director cannot be prevented by the DBS 25

26 Design Quality: Normalization Functional dependencies Generalization of key concept Normal forms: Quality classes for relation schemes with dependencies Two approaches: - Synthesis: Set up relations in certain normal form - Decomposition: decompose given relations into normalized relations 26

27 Design Quality: Normal forms First normal form (1NF) - Basic property of relation - All attributes have atomic domain - NF 2 : Non First Normal Form allows nested relations Second normal form (2NF) - No partial FDs on (candidate) keys for non-key attributes Third normal form (3NF) - No dependencies on non-keys for non-key attributes Boyce-Codd normal form (BCNF) - Only FDs from keys - (4NF for multi-valued dependencies) 27

28 Design Quality: Second normal form Consider: relation R, attribute set R, set of FDs F R in second normal form (2NF), iff - Only single concept modeled in R = Every non-(candidate) key attribute fully depends on every candidate key = non-key A R candidate keys X R : X {A} = X {A} : if A non-key attribute and X candidate key no FD Y {A} with Y X 28

29 Design Quality: Second normal form Example: Movie_two_concepts(id, title, category, year, price_per_day, length, director, birthday, livesincity, ) F: {id {title, category, year, price_per_day, length, director, birthday, livesincity, }, {title, year} {id, category, price_per_day, length, director, birthday, livesincity, }, {title, director} {id, category, year, price_per_day, length, birthday, livesincity, }, director {birthday, livesincity, } } Not in 2NF since {title,director} {birthday, livesincity} 29

30 Design Quality: Third normal form Consider: relation R, attribute set R, set of FDs F R in third normal form (3NF), iff FDs X {A}, X R, A R one of the three conditions holds: 1. A X, i.e. trivial FD 2. A candidate key (A is prim attribute) 3. X superkey in R Alternative: no transitive FDs of non-keys on keys 30

31 Design Quality: Third normal form Example: Tape_with_seller(id, format, movie_id, seller, phone) F: { id {format, movie_id, seller, phone}, seller telephone } In 2NF since id format, id movie_id, id seller, id phone Not in 3NF since id seller phone = (3) {seller} is no superkey 31

32 Design Quality: Boyce-Codd normal form Consider: relation R, attribute set R, set of FDs F R in Boyce-Codd normal form (BCNF), iff FDs X {A}, X R, A R one of the two conditions holds: 1. A X, i.e. trivial FD 2. X superkey in R Alternative: no FDs between partial key attributes 32

33 Design Quality: Boyce-Codd normal form Example: CustomerAddress(zip, city, street, number, telephone) F:{ {city, street, number} {zip, telephone}, {zip, street, number} {city, telephone}, zip city } In 2NF since only full FD of non-keys on keys In 3NF since no transitive FD using non-keys Not in BCNF since zip city: FD between partial key attributes = (2) {zip} is no superkey 33

34 Normalization: Decomposition, Synthesis Loss-less Decomposition/ Synthesis : Split relation R into relations R 1, R 2,..., R n, such that - R i in desired normal form (3NF or BCNF) - preserve information - preserve dependencies Preserve information: R 1 R 2... R n = R Loss-less join Preserve dependencies: F(R 1 ) F(R 2 ) F(R n ) = F(R) 34

35 Normalization: Loss-less join example Example: R(A,B,C), F: {A B, C B } R A B C R 1 R 2 R R 1 R 2 A 1 4 R 1 B 2 2 B 2 2 R 2 C 3 5 = A B C

36 Normalization: Loss-less join example Example: R(A,B,C), F: {A C, C B } R A B C R 1 R 2 = R R 1 R 2 R 1 R 2 A 1 4 C 3 5 C 3 5 B 2 2 = A 1 4 B 2 2 C

37 Normalization: Loss-less joins Loss-less property depends on FDs: Consider: decomposition = (R1,R2) of R, set of FDs F has a loss-less-join with respect to F if and only if: or R (R1) R (R2) R (R1) - R (R2) F + R (R1) R (R2) R (R2) - R (R1) F + 37

38 Normalization: Loss-less joins Example: R(A,B,C), F: {A B, C B } = (R1,R2) R1(A,B), F: {A B} R2(C,B), F: {C B} R (R1) R (R2) R (R1) - R (R2): B A F + R (R1) R (R2) R (R2) - R (R1): B C F + F(R1) F(R2) = F(R) Lossy decomposition Example: R(A,B,C), F: {A C, C B } = (R1,R2) R1(A,C), F: {A C} R2(C,B), F: {C B} R (R1) R (R2) R (R1) - R (R2): C A F + R (R1) R (R2) R (R2) - R (R1): C B F + F(R1) F(R2) = F(R) Loss-less decomposition 38

39 Normalization: Loss-less joins Loss-less join: - R (R1) R (R2) R (R1/2) - R (R2/1) F + = common attributes of R1, R2 form super key of R1 or R2 Normalization side-effect: FDs transformed into key dependent FDs Advantage: FDs efficiently checked by DB 39

40 Normalization: Synthesis Given: schema R, set of FDs F Algorithm: 1. Find minimal cover min(f) of F 2. FD X Y F: Define R x with R(R x ):= X Y F(R x ):= {X' Y' X' Y' R(R x )} 3. If no R X contains a candidate key of R: define R key, R(R key ):=candidate key(r), F(R key )={}, 4. Remove R Y where: R(R Y ) R(R X ) Result: loss-less decomposition of R, with R i in 3NF (preserves information and dependencies) 40

41 Design Quality: Synthesis Example Example: Movie_two_concepts(id, title, category, year, price_per_day, length, director, birthday, livesincity, ) 1. Minimal cover: {id {title, year}, {title, year} {id, category, price_per_day, length, director}, {title, director} {title, year}, director {birthday, livesincity, } } 2. Define relations: R1(id, title, year) R2(id, title, year, category, price_per_day, length, director) R3(title, director, year), R4(director,birthday, livesincity, ) 3., not necessary 4., remove R1, R3 41

42 Normalization: Decomposition Given: schema R, set of FDs F Algorithm: res:={r} while relation schema in res not in BCNF{ choose such schema R k in res } find BCNF-violating FD X Y in R k (X R(R k ), X Y= ) split R k into R i, R j : R(R i ) = R(R k ) - Y, R(R j ) = X Y Result: decomposition of R, R i in BCNF (preserves information, possible dependency loss) 42

43 Normalization: Decomposition Example Example: Movie_two_concepts(id, title, category, year, price_per_day, length, director, birthday, livesincity, ) Violating FD: director {birthday, livesincity, } Split: R1(id, title, category, year, price_per_day, length, director), R2(director, birthday, livesincity, ) F(R1): {id {title, category, year, price_per_day, length, director}, {year, director} {id, title, category, price_per_day, length}, {title, director} {id, category, year, price_per_day, length}} F(R2): {director {birthday, livesincity, }} 43

44 Normalization: 3NF vs BCNF BCNF decomposition: Loss-less join property and dependency preservation not guaranteed Normalization to 3NF best achievable result If at most one candidate key with more than one attribute: 3NF = BCNF Example: - CustomerAddress(zip, city, street, number, telephone) - Normalization to BCNF: R1 (zip,street,number,telephone), R2(zip,city) - Lost dependency {city, street, number} zip 44

45 Normalization: Algorithms Decomposition - May produce more relations than necessary - Time consuming: compute keys for each schema - Not dependency preserving - Not deterministic (depends on FD order) Synthesis: - Time consuming: compute minimal cover - Not deterministic (depends on minimal cover) Problem: - Designer must specify initial set of FDs 45

46 Design Quality: Multi-valued dependencies Special attribute dependencies Example: mem_no Customer_preferences fav_movie telephone only trivial functional dependencies: BCNF mem_no > fav_movie mem_no > telephone 46

47 Design Quality: Multi-valued dependencies Multi-valued dependencies (MVD) - Generalization of FDs - Notation: X > Y Definition single attribute MVD: Consider R = (a, b, c), a > b if for each two tuples t1, t2 with t1[a]=t2[a] exist tuples t3, t4 with - t1[a]=t2[a]=t3[a]=t4[a] - t1[b]=t3[b] and t2[b]=t4[b] - t2[c]=t3[c] and t1[c]=t4[c] 47

48 Design Quality: Multi-valued dependencies Consider: relation R, X,Y,Z,W attribute sets in R Properties: - X > Y trivial MVD if Y Y or Y = R(R) -X - Complement: if X > Y then X > R(R) -X Y - Multi-valued augmentation: if X > Y, W Zthen ZX WY - Multi-valued transitivity: if X > Y, Y > Z then X > Z-Y - Generalization: if X Y then X > Y 48

49 Design Quality: Fourth normal form Consider: relation R, attribute set R, set of FDs F R in fourth normal form (4NF), iff multi-valued FDs X > Y one of the three conditions holds: 1. Y X (trivial MVD) 2. Y = R(R) X (trivial MVD) 3. X superkey in R 49

50 Design Quality: 4NF decomposition Given: schema R, set of FDs F Algorithm (analog BCNF decomposition): res:={r} while relation schema in res not in 4NF{ choose such schema R k in res find 4NF-violating FD X > Y in R k (X R(R k ), X Y= ) split R k into R i, R j : R(R i ) = R(R k ) - Y, R(R j ) = X Y } Result: decomposition of R, R i in BCNF (preserves information, possible dependency loss) 50

51 Normalization: 4NF decomposition example Example: Customer_preferences(mem_no, fav_movie, telephone, ) F(Customer): {mem_no > fav_movie, mem_no > telephone} Violating FDs: mem_no > fav_movie, mem_no > telephone Split: R1(mem_no, telephone), R2(mem_no, fav_movie) F(R1): {}, mem_no > fav_movie trivial F(R2): {}, mem_no > telephone trivial 51

52 Design Quality: Normal forms Relationships: 1NF 2NF 3NF BCNF 4NF dependency-preserving decomposition information-preserving decomposition 52

53 Normalization: Example Movie(id, title, category, year, director, price_per_day, length) F(Movie):{id {title,category,year,director,price_per_day,length}, {title,year} {id,category,director,price_per_day,length}, {director, year} {id,title,category,price_per_day,length}} F min (Movie):{id {title,category,year,director,price_per_day,length}, {title,year} id, {director, year} id}} 1NF: since only atomic attributes 2NF: since id {title,category,year,director,price_per_day,length}, {title,year} {title,category,year,director,price_per_day,length}, {director, year} {title,category,year,director,price_per_day,length} 3NF: since id,{title,year},{director, year} superkeys BCNF: since id,{title,year},{director, year} superkeys 53

54 Normalization: Example Tape(id, format, movie_id) F(Tape):{id {format, movie_id}} F min (Tape):{id {format, movie_id}} 1NF: since only atomic attributes 2NF: since id {format, movie_id} 3NF: since id is superkey BCNF: since id is superkey Format(name, charge) F(Format): {name charge} F min (Format): {name charge} BCNF: since name is superkey 1NF, 2NF, 3NF since BCNF 54

55 Normalization: Example Actor(stage_name, real_name, birthday) F(Actor):{stage_name {real_name, birthday}} F min (Actor):{stage_name {real_name, birthday}} BCNF: since name is superkey 1NF, 2NF, 3NF since BCNF Play(movie_id, actor_name) F(Play): {}, only trivial dependencies F min (Play): {} BCNF: since only trivial dependencies 1NF, 2NF, 3NF since BCNF 55

56 Normalization: Example Customer(mem_no, last_name, first_name, address, telephone) F(Customer):{mem_no {last_name,first_name,address,telephone}} F min (Customer):{mem_no {last_name,first_name,address,telephone}} 1NF: since only atomic attributes (address not stuctured) 2NF: since mem_no {last_name,first_name,address,telephone} 3NF: since id is superkey BCNF: since id is superkey Rental(tape_id, member, from, until) F(Rental): {{tape_id, member, from} until} F min (Rental): {{tape_id, member, from} until} BCNF: since {tape_id, member, from} is superkey 1NF, 2NF, 3NF since BCNF 56

57 Normalization: Design Quality Should relations always be normalized? Important Yes : - Makes invariant checking easy, - No update anomalies No : - No updates (e.g., data warehouses) Decision according to cost model: - Costs of selects, - Cost of joins, - #redundant data, - #updates, 57

58 Normalization: Design Quality ER modeling and Normal Forms: - Two mechanisms to set up or enhance a database scheme - ER more intuitive, NF uses algorithms - ER-models often already in NF Normalization as a complementary design tool - Create ER model - Transform to relations - Normalize each non-normalized relation according to tradeoff: query time vs redundant data update 58

59 Design Quality: Short summary Redundancies cause anomalies - Insert anomaly - Deletion anomaly - Update anomaly Functional Dependencies - Describe constraints between attributes - Properties (Armstrong) Normal forms - 1NF, 2NF, 3NF, BCNF - Normalization: Decomposition, Synthesis - Design Quality: query time vs redundant update 59

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Databases 2012 Normalization

Databases 2012 Normalization Databases 2012 Christian S. Jensen Computer Science, Aarhus University Overview Review of redundancy anomalies and decomposition Boyce-Codd Normal Form Motivation for Third Normal Form Third Normal Form

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

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

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

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 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

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

CSE 303: Database. Outline. Lecture 10. First Normal Form (1NF) First Normal Form (1NF) 10/1/2016. Chapter 3: Design Theory of Relational Database

CSE 303: Database. Outline. Lecture 10. First Normal Form (1NF) First Normal Form (1NF) 10/1/2016. Chapter 3: Design Theory of Relational Database CSE 303: Database Lecture 10 Chapter 3: Design Theory of Relational Database Outline 1st Normal Form = all tables attributes are atomic 2nd Normal Form = obsolete Boyce Codd Normal Form = will study 3rd

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

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

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

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

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

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

11/1/12. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design)

11/1/12. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design) Relational Schema Design Introduction to Management CSE 344 Lectures 16: Database Design Conceptual Model: Relational Model: plus FD s name Product buys Person price name ssn Normalization: Eliminates

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

11/6/11. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design)

11/6/11. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design) Relational Schema Design Introduction to Management CSE 344 Lectures 16: Database Design Conceptual Model: Relational Model: plus FD s name Product buys Person price name ssn Normalization: Eliminates

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

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 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

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

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

Design Theory for Relational Databases

Design Theory for Relational Databases Design Theory for Relational Databases Keys: formal definition K is a superkey for relation R if K functionally determines all attributes of R K is a key for R if K is a superkey, but no proper subset

More information

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

CAS CS 460/660 Introduction to Database Systems. Functional Dependencies and Normal Forms 1.1 CAS CS 460/660 Introduction to Database Systems Functional Dependencies and Normal Forms 1.1 Review: Database Design Requirements Analysis user needs; what must database do? Conceptual Design high level

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

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

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

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

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

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

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

CSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018 CSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018 Announcement Read Chapter 14 and 15 You must self-study these chapters Too huge to cover in Lectures Project 2 Part 1 due tonight Agenda 1.

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lectures 18: BCNF 1 What makes good schemas? 2 Review: Relation Decomposition Break the relation into two: Name SSN PhoneNumber City Fred 123-45-6789 206-555-1234

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

CSE 344 MAY 16 TH NORMALIZATION

CSE 344 MAY 16 TH NORMALIZATION CSE 344 MAY 16 TH NORMALIZATION ADMINISTRIVIA HW6 Due Tonight Prioritize local runs OQ6 Out Today HW7 Out Today E/R + Normalization Exams In my office; Regrades through me DATABASE DESIGN PROCESS Conceptual

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

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

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

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

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

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

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

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

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

Design Theory. Design Theory I. 1. Normal forms & functional dependencies. Today s Lecture. 1. Normal forms & functional dependencies

Design Theory. Design Theory I. 1. Normal forms & functional dependencies. Today s Lecture. 1. Normal forms & functional dependencies Design Theory BBM471 Database Management Systems Dr. Fuat Akal akal@hacettepe.edu.tr Design Theory I 2 Today s Lecture 1. Normal forms & functional dependencies 2. Finding functional dependencies 3. Closures,

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

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

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

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

Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein Reference: A First Course in Database Systems, 3 rd edition, Chapter 3 Important Notices CMPS 180 Final Exam

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

CSE 344 AUGUST 3 RD NORMALIZATION

CSE 344 AUGUST 3 RD NORMALIZATION CSE 344 AUGUST 3 RD NORMALIZATION ADMINISTRIVIA WQ6 due Monday DB design HW7 due next Wednesday DB design normalization DATABASE DESIGN PROCESS Conceptual Model: name product makes company price name address

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

CS322: Database Systems Normalization

CS322: Database Systems Normalization CS322: Database Systems Normalization Dr. Manas Khatua Assistant Professor Dept. of CSE IIT Jodhpur E-mail: manaskhatua@iitj.ac.in Introduction The normalization process takes a relation schema through

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

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

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

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

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

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

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

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

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

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

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

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

CSE 344 AUGUST 6 TH LOSS AND VIEWS

CSE 344 AUGUST 6 TH LOSS AND VIEWS CSE 344 AUGUST 6 TH LOSS AND VIEWS ADMINISTRIVIA WQ6 due tonight HW7 due Wednesday DATABASE DESIGN PROCESS Conceptual Model: name product makes company price name address Relational Model: Tables + constraints

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

Lectures 6. Lecture 6: Design Theory

Lectures 6. Lecture 6: Design Theory Lectures 6 Lecture 6: Design Theory Lecture 6 Announcements Solutions to PS1 are posted online. Grades coming soon! Project part 1 is out. Check your groups and let us know if you have any issues. We have

More information

Introduction to Database Systems CSE 414. Lecture 20: Design Theory

Introduction to Database Systems CSE 414. Lecture 20: Design Theory Introduction to Database Systems CSE 414 Lecture 20: Design Theory CSE 414 - Spring 2018 1 Class Overview Unit 1: Intro Unit 2: Relational Data Models and Query Languages Unit 3: Non-relational data Unit

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. 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

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

CSC 261/461 Database Systems Lecture 11

CSC 261/461 Database Systems Lecture 11 CSC 261/461 Database Systems Lecture 11 Fall 2017 Announcement Read the textbook! Chapter 8: Will cover later; But self-study the chapter Everything except Section 8.4 Chapter 14: Section 14.1 14.5 Chapter

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

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

CSC 261/461 Database Systems Lecture 8. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 CSC 261/461 Database Systems Lecture 8 Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 Agenda 1. Database Design 2. Normal forms & functional dependencies 3. Finding functional dependencies

More information

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

CS122A: Introduction to Data Management. Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li CS122A: Introduction to Data Management Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li 1 Third Normal Form (3NF) v Relation R is in 3NF if it is in 2NF and it has no transitive dependencies

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

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

Introduction to Management CSE 344

Introduction to Management CSE 344 Introduction to Management CSE 344 Lectures 17: Design Theory 1 Announcements No class/office hour on Monday Midterm on Wednesday (Feb 19) in class HW5 due next Thursday (Feb 20) No WQ next week (WQ6 due

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

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

INF1383 -Bancos de Dados

INF1383 -Bancos de Dados INF1383 -Bancos de Dados Prof. Sérgio Lifschitz DI PUC-Rio Eng. Computação, Sistemas de Informação e Ciência da Computação Projeto de BD e Formas Normais Alguns slides são baseados ou modificados dos originais

More information

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

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

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

CS 186, Fall 2002, Lecture 6 R&G Chapter 15

CS 186, Fall 2002, Lecture 6 R&G Chapter 15 Schema Refinement and Normalization CS 186, Fall 2002, Lecture 6 R&G Chapter 15 Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus Functional Dependencies (Review)

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