Normalization 03. CSE3421 notes
|
|
- Pauline Morrison
- 5 years ago
- Views:
Transcription
1 Normalization 03 CSE3421 notes 1
2 Example F: A B (1) ABCD E (2) EF G (3) EF H (4) ACDF EG (5) Calculate the minimal cover of F. 2
3 Step 1: Put F in standard form FDs (1) (4) are already in standard form. For FD (5): ACDF E (5.1) ACDF G (5.2) 3
4 Step 2: eliminate extraneous attiributes from LHS (minimize LHSs) (1) A B : nothing to eliminate. (2) ABCD E. If delete A, will have BCD E. Is this LHS good enough? It is, if either BCD E, or BCD W, such that W contains ABCD (the original LHS). Note, (BCD)+ = BCD. Therefore, cannot delete A. 4
5 Can we delete B? If so, then will have ACD E Is this LHS good enough? It is, if either ACD E, or ACD W that contains ABCD. Note, ACD ACD ABCD. Therefore, ACD W = ABCD, and thus B can be eliminated! So, ABCD E becomes ACD E. 5
6 Can I delete any more? i.e., delete C or D? If delete C, then ACD E becomes AD E. Test: AD AD ABD, does not contain ACD. Therefore, cannot delete C. Similarly, cannot delete D. Since we finished scanning the entire LHS of this FD, step 2 is finished for this FD, and the resulting FD is ACD E (2.1) replaces (2) of original F. 6
7 Repeat the above process for FDs (3), (4), (5.1), (5.2). For (3): EF G. 1. Can I delete E?... If so, will have F G. not possible check. 2. Can I delete F? if so, will have E G not possible.. Check. Therefore, there is no change in (3). 7
8 For (4) : EF H Again, cannot delete anything from LHS. For (5.1) [ ACDF E ]. Delete A? CDF E? Or, CDF W that contains ACDF? (CDF)+ = CDF, which is neither E nor W. cannot delete A. 8
9 For (5.1) [ ACDF E ] Delete C? ADF E, or ADF W that contains ACDF. ADF ADF from (1) ABDF, which does contain E or ACDF. Cannot delete C. 9
10 For (5.1) [ ACDF E ] Delete D? ACF E, or ACF W that contains ACDF. ACF ACF from (1) ABCF, which does not contain E or ACDF. Cannot delete D. 10
11 For (5.1) [ ACDF E ] Delete F? ACD E, or ACD W that contains ACDF. ACD ACD from (1) ABCD from (2) ABCDE, which contains E!! Therefore, F can be deleted from the LHS of (5.1), and (5.1) becomes ACD E (5.1.1) Finished step 2 of (5.1)!!.. On to (5.2) 11
12 ACDF G (5.2) Repeat the above process and find that nothing can be eliminated from the LHS of (5.2). So step 2 of the minimal cover computation is finished (we minimized all LHSs of all FDs). 12
13 The resulting FDs from step 2, are: A B (1) (1) ACD E (2.1) (2) EF G (3) (3) EF H (4) (4) ACD E (5.1.1) ACDF G (5.2) (5) Same as (2)!! 13
14 Now proceed to step 3: Eliminate redundant FDs Start top-to-bottom (can start bottom-to-top, but may get different result, although still a minimal cover). Is (1) A B redundant? If so, then the rest of the FDs must produce A B. Observe that if A B is deleted, then A can generate A only (A A) and thus A B cannot be deleted. 14
15 Is (2) [ ACD E ] redundant? (ACD)+ =? ACD ACD from (1) [A B] ABCD. Since ABCD does not contain E, we conclude that ACD E is not redundant. 15
16 Is (3) [ EF G] redundant? (EF)+ =? EF EF (4) EF H EFH. Since EFH does not contain G, we conclude that EF G is not redundant. 16
17 EF EF Is (4) [ EF H] redundant? (3) EF G EFG. EFG does not contain H, so EF H is not redundant. 17
18 Is (5) [ ACDF G] redundant? ACDF ACDF (1) A B ABCDF (2) ACD E ABCDFE (3) EF G ABCDFEG. Since ABCDFEG contains G, ACDF G is redundant!!!! So can eliminate this FD. This is the end of step 3!!! 18
19 A B (1) ACD E (2) EF G (3) EF H (4) The minimal cover is: This is the minimal cover of F. 19
20 Another example of minimal cover F: ABH C (1) A D (2) C E (3) BGH F (4) F AD (5) E F (6) BH E (7) Find a minimal cover for F. 20
21 Step 1: Put F in standard form All FDs are already in standard form, except (5) (5) F AD: F A (5.1) F D (5.2) 21
22 Step 2: Eliminate redundant attributes from LHSs Check FD (1): ABH C Is A redundant? If so, then BH C or BH W that contains ABH BH (7) BH E BHE (6) E F BHEF (5) F AD BHEFAD. Since BHEFAD contains ABH, A is redundant! ABH C becomes BH C (1.1) 22
23 In BH C, is B redundant? no (check) Is H redundant? no (check) Check FD (2) A D Nothing can be redundant. Check FD (3) C E Nothing can be redundant 23
24 Check FD (4) : BGH F Is B redundant? If so, then GH F, or GH W that contains BGH GH GH is the only thing that can derive. Therefore, B is not redundant. Is G redundant? BH BH (1.1) BH C BHC (3) C E BHCE (6) E F BHCEF, contains F G is redundant! Note: upon eliminating G here, attribute G is completely lost from the set of FDs!!! Is H redundant? no (check) Therefore, BGH F becomes BH F (4.1) 24
25 Check FDs F AD (5) F A (5.1) F D (5.2) E F (6) BH E (7) Nothing redundant 25
26 Step 3: Eliminate redundant FDs Check BH C (1.1) Is this FD redundant? If so, then BH W that contains C BH BH (7) BH E BHE (6) E F BHEF (5.1),(5.2) F A, F D BHEFAD BHEFAD does not contain C. So BH C is not redundant. 26
27 A A, only. Not redundant Is (2) A D redundant? 27
28 C C, only. Not redundant. Is (3) C E redundant? 28
29 Is (4.1) BH F redundant? BH BH (1.1) BH C BHC (3) C E BHCE (6) E F BHCEF, which contains F. Therefore, BH F is redundant! Eliminate BH F 29
30 F F Is (5.1) F A redundant? (5.2) F D FD, which does not contain A F A is not redundant 30
31 Is (5.2) F D redundant? F F (5.1) F A FA (2) A D FAD, which contains D. F D is redundant! 31
32 E E, only. Is (6) E F redundant? E F is not redundant. 32
33 Is (7) BH E redundant? BH BH (1.1) BH C BHC (3) C E BHCE, which contains E! BH E is redundant! Eliminate BH E 33
34 BH C (1) A D (2) C E (3) F A (4) E F (5) The minimal cover is: Note: the minimal cover does not involve original attribute G!!! (i.e. G is lost). 34
35 Cost of calculating the minimal cover O(mc (F)) =? Assume F has k FDs Assume F has N attributes (over all FDs) O(mc) = O ( step 1) + O ( step 2) + O ( step 3) 35
36 Cost of step 1: O (step 1) Put each FD in standard form Have to scan entire FD O (N) for each FD k * O(N) for all FDs 36
37 Cost of step 2: O (step 2) Eliminate redundant attributes from LHSs For each FD X Y: For each attribute of the FD: Cost to check if can eliminate that attribute from LHS == cost to calculate closure of a set of attributes == cc. [ cc can be around O(N^2) or O(N^3)] Therefore, for each FD: O(N) * cc. So for all FDs, cost is: k * O(N) * cc 37
38 Cost of step 3: O (step 3) Eliminate redundant FDs For each FD X Y, check if this FD is redundant. The FD is redundant if X+ contains Y, using the other FDs. The cost to calculate that is cc for each FD. Therefore, for all FDs, the cost would be k * cc 38
39 Total cost (cost of minimal cover calculation) O(mc) = O ( step 1) + O ( step 2) + O ( step 3) = k * O( N ) + k*o(n)*cc + k*cc = O(k*N*cc) = O(k*N^3), assuming that cc = O(N^2), Or O(k*N^4), assuming that cc = O(N^3). 39
40 Cost on the average On the average, we assume that the attributes are equally distributed among FDs and also between the LHS and RHS of each FD. Then, each RHS (and each LHS) has N/2k attributes. Then the cost of MC is: O(k*N/2k*cc) = O(cc*N/2) = O(N*cc) = O(N^3) or O(N^4). 40
41 Non-uniqueness of minimal covers When calculating a MC, the outcome of steps 2 and 3 may depend on the order in which we test the candidates for removal (both attributes and FDs). i.e., a set of FDs may have several minimal covers. 41
42 F: A B (1) B C (2) C A (3) A C (4) C B (5) B A (6) Example : Find the MC 42
43 Step 1: Put F in standard form Nothing to do. It is already in standard form. 43
44 Step 2: Eliminate redundant attributes from LHSs Nothing to do. LHSs are already minimal. 44
45 Step 3: Eliminate redundant FDs Start from bottom of F Is (6): B A redundant? B B (2) B C BC (3) C A BCA, which contains A. Therefore, B A is redundant. Is (5): C B redundant? C C (3) C A CA (1) A B CAB, which contains B. Therefore, C B is redundant. Is (4): A C redundant? A A (1) A B AB (2) B C ABC, which contains C. Therefore, A C is redundant. 45
46 Is (3): C A redundant? C C. Therefore C A is not redundant. Is (2): B C redundant? B B. Therefore B C is not redundant. Is (1): A B redundant? A A. Therefore A B is not redundant. 46
47 The minimal cover is: A B (1) B C (2) C A (3) 47
48 Now process from top of F, for step 3 Is (1): A B redundant? A A (4) A C AC (5) C B ACB, which contains B. Therefore, A B is redundant. Is (2): B C redundant? B B (6) B A BA (4) A C BAC, which contains C. Therefore, B C is redundant. Is (3): C A redundant? C C (5) C B CB (6) B A CBA, which contains A. Therefore, C A is redundant. 48
49 Is (4): A C redundant? A A. Therefore, A C is not redundant. Is (5): C B redundant? C C. Therefore, C B is not redundant. Is (6): B A redundant? B B. Therefore, B A is not redundant. 49
50 The minimal cover is: A C (4) C B (5) B A (6) (different from the minimal cover of when we process the FDs bottom-to-top). 50
51 Another minimal cover example (try it as exercise) F: AB C C A BC D ACD B D E D G BE C CG B CG D CE A CE G MC 1 AB C C A BC D CD B D E D G BE C CG D CE G MC 2 AB C C A BC D D E D G BE C CG B CE G 51
52 Where are we X+: Closure of set of attributes F+: closure of set of FDs MC: minimal cover of F Preservation of dependencies Lossless join property Algorithm to compute 3NF 52
53 3NF Synthesis algorithm Given a relation R, find a decomposition of R that is: 1) In 3NF 2) Has Lossless join property 3) Preserves dependencies 53
54 Given set of FDs F: Steps for 3NF synthesis I. Construct minimal cover of F II. Group FDs with same LHS All FDs with the same LHS become one FD with that LHS and as its RHS the union of all RHSs. III. Add key relation, if necessary If X is a key for R and X is not in a relation resulted from steps 1 and 2, then add the relation X. (this will guarantee lossless join). 54
55 In 3NF synthesis algorithm Step I Step II 3NF + preserved dependencies. Step III 3NF + preserved dependencies + lossless join property. 55
56 Example of 3NF synthesis F: A B (1) C B (2) 56
57 I. construct MC Step 1: standard form FDs are already in standard form. Step 2: eliminate redundant attributes There are none to eliminate. Step 3: eliminate redundant FDs. There are none to eliminate the minimal cover is F itself. 57
58 II. Combine FDs with same LHS. already done (there are none to combine). III. Add key relation, if necessary. AC is a key in R. add relation AC 58
59 Result The resulting decomposition is: (R1, R2, R3) (R1, R2, R3) R1 (A, B) R2 (B, C) R3 (A, C) A B C B -- 59
60 Another example of 3NF synthesis F: AB C (1) A B (2) B A (3) 60
61 I. construct MC 3NF synthesis example Step 1: standard form FDs are already in standard form. 61
62 3NF synthesis example (I). construct MC Step 2: eliminate redundant attributes Check AB C Is A redundant? If so, then B C or B W that contains AB.»B B (3) BA, which contains AB.» A is redundant!» AB C becomes B C (1.1) Check FDs (2) and (3) nothing redundant there. F becomes: B C (1.1) A B (2) B A (3) 62
63 3NF synthesis example (I). construct MC / Step 3: eliminate redundant FDs. Is (1.1): B C, redundant? If so, then (2) and (3) can produce equivalent B B (3) BA, which does NOT contain C. Therefore, (1.1): B C is not redundant! and no other FD is redundant either. (check ) done with MC computation! the MC is: B C (1) A B (2) B A (3) 63
64 3NF synthesis example (II). Combine FDs with same LHS / the MC is: B C (1) A B (2) B A (3) (1) & (3) : B AC (2) : A B The new F. 64
65 3NF synthesis example (III). Add relation with X key, if necessary / This is not necessary here, since B is a key and B AC forms a relation already. 65
66 The resulting schema is (R1, R2) R1 R2 A, B, C A, B B AC A B (notice the redundancy!!!) 66
67 Another example of 3NF synthesis ( from a previous example) F: ABH C (1) A D (2) C E (3) BGH F (4) F AD (5) E F (6) BH E (7) Perform 3NF synthesis on the above F. 67
68 Done before. MC is: BH C (1) A D (2) C E (3) F A (4) E F (5) construct MC Note: the minimal cover does not involve original attribute G!!! (i.e. G is lost). 68
69 (II). Combine FDs with same LHS Nothing to do 69
70 (III). Add key relation, if necessary Note, none of (1).. (5) of the MC contain enough attributes to form a key for the entire set of attributes (since attribute G was lost in the way). The closest such FD is BH C, since BH ABCDEFH since all attributes are derived, except G. Note that BGH is a key for the entire set of attributes (including attribute G). So BGH is a key relation. 70
71 The resulting schema is (R1, R2, R3, R4, R5, R6) R1 B, C, H R2 A, D R3 C, E R4 A, F R5 E, F R6 B, G, H BH C A D C E F A E F -- 71
72 Where are we X+: Closure of set of attributes F+: closure of set of FDs MC: minimal cover of F Preservation of dependencies Lossless join property Algorithm to compute 3NF 72
73 BCNF (Boyce-Codd Normal Form) (a.k.a. 3 ½ NF) A relation R with F is in BCNF if for any FD X A in F such that A is not contained in X, X is a superkey of R. (i.e., X is or contains a key of R). In other words, the only non-trivial dependencies are those in which a key functionally determines one or more other attributes. 73
74 Example 1 R = (C, S, Z) C: city S: state Z: zip code F: CS Z Z C Is NOT in BCNF, since Z C violates BCNF: Z C is in F, such that C is not contained in Z and Z is NOT a superkey in R. (for that matter, Z is not even a key in R). 74
75 Example 2 Person = (SSN, name, address, hobby) [ key :: SSN, hobby] F: SSN name (1) SSN, hobby name, address (2) ( FD (1) is given, FD (2) is derived from relation Person ). FD (1) violates BCNF since SSN is not a key. Person is not in BCNF. 75
76 Example 3 HasAccount = (acc#, clientid, officeid) [ key :: clientid, officeid] F: acc# officeid (1) clientid, officeid acc# (2) ( FD (1) is given, FD (2) is derived from relation HasAccount ). FD (1) violates BCNF since acc# is not a key. HasAccount is not in BCNF. 76
77 Example 4 Members = (name, address, balance) [ key :: name] Orders = (order#, name, item, qty) [ key :: order#] F: name address, balance order# name, item, qty (1) in Members (2) in Orders Is in BCNF 77
78 How to decompose R into BCNF? Assume R is not in BCNF. there is a FD X A that violates BCNF. Decompose R into R A and XA; repeat, if R A and/or XA is not in BCNF. R R A X A 78
79 R = (C, T, H, R, S, G) C: course T: teacher H: hour R: room S: student G: grade Example 1 79
80 F: C T //each course has one teacher. HR C //only 1 course per room at a time. HT R //only 1 teacher in a room at a time. CS G //each student has 1 grade in each course. HS R //a student can only be in 1 room at one time. (Notice, the only key is HS) (HS)+: HS HS HSR HSRC HSRCG HSRCGT, all attributes. CS G of R violates BCNF since CS is not a key. decompose R 80
81 decompose R = (C, T, H, R, S, G): CS G of R violates BCNF ( A = G; X = CS ) ( R ) C T H R S G ( R A ) C T H R S C T HR C HT R HS R Check if CTHRS is in BCNF ( XA ) C S G CS G Violates BCNF, since C is not a key. CTHRS not in BCNF. In BCNF 81
82 decompose (C, T, H, R, S): its C T violates BCNF ( A = T; X = C ) C T H R S ( R A ) C H R S HR C HS R Check if CHRS is in BCNF ( XA ) C T C T In BCNF Violates BCNF, since HR is not a key. CHRS not in BCNF. Note: HT R is lost! i.e., not preserved. (BCNF does not necessarily preserve dependencies). 82
83 decompose (C, H, R, S): its HR C violates BCNF ( A = C; X = HR ) C H R S ( R A ) ( XA ) H R S In BCNF H R C In BCNF HS R HR C 83
84 overview of decomposition ( R ) C T H R S G C T H R S C T HR C HT R HS R C T C T In BCNF C S G CS G In BCNF C H R S HR C HS R H R C HR C In BCNF H R S HS R In BCNF 84
85 R = (St, C, Sem, P, T, R) St: Student C: course Sem: semester P: professor T: time R: room Example 2 85
86 F: St, C, Sem P (1) P, Sem C (2) C, Sem, T P (3) P, Sem, T C, R (4) P, Sem, C, T R (5) P, Sem, T C (6) Convert to BCNF 86
87 Another approach 1. Convert to 3NF using the 3NF synthesis algorithm (resulting to 3NF, with preserved dependencies and lossless join property). I. Construct MC II. Group FDs with same LHS III. Add key relation, if necessary 2. Then convert those 3NFs that are not BCNFs, into BCNF (may lose some dependencies, but ok). 87
88 (I) Construct minimal cover Step 1: convert to standard form. Is in SF already, except FD (4): P, Sem, T C (4.1) P, Sem, T R (4.2) Step 2: eliminate redundant attributes from LHSs. (check and do it ) Step 3: eliminate redundant FDs. (check and do it ) 88
89 The minimal cover is: St, C, Sem P (1) P, Sem C (2) C, Sem, T P (3) P, Sem, T R (4) 89
90 (II) Group FDs with same LHS Already done St, C, Sem P (1) P, Sem C (2) C, Sem, T P (3) P, Sem, T R (4) 90
91 After (I) and (II), have 3NF and preserved dependencies. (R1, R2, R3, R4) R1 St, C, Sem, P R2 P, Sem, C R3 C, Sem, T, P R4 P, Sem, T, R St, C, Sem P P, Sem C C, Sem, T P P, Sem, T R To complete the 3NF synthesis algorithm, we should look for key relation as well. But since we have 3NF already and we only look for BCNF, this step is not necessary. (try it as an exercise ) Notice, this dependency refers also to R1 and R3! 91
92 Above schema is not in BCNF For example, in R1: R1 = (St, C, Sem, P ) St, C, Sem P (1) P, Sem C (2) FD (1) satisfies BCNF But FD (2) does not satisfy BCNF, since P, Sem is not a key. decompose R1 92
93 decompose R1 = (St, C, Sem, P ): P, Sem C of R1 violates BCNF ( A = C; X = P Sem ) ( R1 ) R11 ( R1 A ) St, Sem, P St, C, Sem, P In BCNF R12 ( XA ) P, Sem, C In BCNF < no FDs here. Lost an FD! > P, Sem C Identical to R2 one of them will be discarded. 93
94 Also, R3 is not in BCNF since FD (2) [ P, Sem C ] violates BCNF. decompose R3 ( R3 ) R31 C, Sem, T, P R32 ( R3 A ) Sem, T, P In BCNF ( XA ) P, Sem, C In BCNF < no FDs. Lost C,Sem,T P! > P, Sem C Identical to R2 and R12 only one of them will be kept. 94
95 The final BCNF decomposition is: (R11, R12, R31, R4) R11 R12 (or R2, or R32) R31 St, Sem, P P, Sem, C Sem, T, P -- P, Sem C -- R4 P, Sem, T, R P, Sem, T R 95
96 Also, notice If add, for example, (St, T, Sem, P) with no dependencies, in the original 3NF schema, have lossess join. If add this one to the final BCNF schema, then also have BCNF with lossless join. 96
97 End of Normalization 03 97
98 End of Normalization 98
BCNF. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong BCNF
Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong Recall A primary goal of database design is to decide what tables to create. Usually, there are two principles:
More informationReview: Attribute closure
CS445 - Introduction to Database Management Systems Fall Semester 2015 LECTURE 10 Functional Dependencies, Normalization Part II TEXTBOOK REFERENCE: CHAPTER 19 CS445 DATABASES: LECTURE 10 1 Review: Attribute
More informationSchema Refinement & Normalization Theory 2. Week 15
Schema Refinement & Normalization Theory 2 Week 15 1 How do we know R is in BCNF? If R has only two attributes, then it is in BCNF If F only uses attributes in R, then: R is in BCNF if and only if for
More informationCSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization
CSE 544 Principles of Database Management Systems Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to
More informationNormalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design
1 Normalization What and Why Normalization? To remove potential redundancy in design Redundancy causes several anomalies: insert, delete and update Normalization uses concept of dependencies Functional
More informationCSIT5300: Advanced Database Systems
CSIT5300: Advanced Database Systems L06: Relational Database Design BCNF Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong SAR,
More informationCS 2451 Database Systems: Database and Schema Design
CS 2451 Database Systems: Database and Schema Design http://www.seas.gwu.edu/~bhagiweb/cs2541 Spring 2018 Instructor: Dr. Bhagi Narahari Relational Model: Definitions Review Relations/tables, Attributes/Columns,
More informationPart II: Using FD Theory to do Database Design
Part II: Using FD Theory to do Database Design 32 Recall that poorly designed table? part manufacturer manaddress seller selleraddress price 1983 Hammers R Us 99 Pinecrest ABC 1229 Bloor W 5.59 8624 Lee
More informationFunctional Dependencies and Finding a Minimal Cover
Functional Dependencies and Finding a Minimal Cover Robert Soulé 1 Normalization An anomaly occurs in a database when you can update, insert, or delete data, and get undesired side-effects. These side
More informationCSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization
CSE 544 Principles of Database Management Systems Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to this
More informationFunctional Dependencies CS 1270
Functional Dependencies CS 1270 Constraints We use constraints to enforce semantic requirements on a DBMS Predicates that the DBMS must ensure to be always true. Predicates are checked when the DBMS chooses
More informationCSE 562 Database Systems
Goal CSE 562 Database Systems Question: The relational model is great, but how do I go about designing my database schema? Database Design Some slides are based or modified from originals by Magdalena
More informationCarnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Overview - detailed. Goal. Faloutsos & Pavlo CMU SCS /615
Faloutsos & Pavlo 15-415/615 Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications Lecture #17: Schema Refinement & Normalization - Normal Forms (R&G, ch. 19) Overview - detailed
More informationThe Relational Data Model
The Relational Data Model Lecture 6 1 Outline Relational Data Model Functional Dependencies Logical Schema Design Reading Chapter 8 2 1 The Relational Data Model Data Modeling Relational Schema Physical
More informationCMU SCS CMU SCS CMU SCS CMU SCS whole nothing but
Faloutsos & Pavlo 15-415/615 Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications Lecture #17: Schema Refinement & Normalization - Normal Forms (R&G, ch. 19) Overview - detailed
More informationSchema Refinement and Normal Forms
Schema Refinement and Normal Forms Chapter 19 Quiz #2 Next Wednesday Comp 521 Files and Databases Fall 2010 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational
More informationCOSC Dr. Ramon Lawrence. Emp Relation
COSC 304 Introduction to Database Systems Normalization Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Normalization Normalization is a technique for producing relations
More informationUNIT 3 DATABASE DESIGN
UNIT 3 DATABASE DESIGN Objective To study design guidelines for relational databases. To know about Functional dependencies. To have an understanding on First, Second, Third Normal forms To study about
More informationDatabases -Normalization I. (GF Royle, N Spadaccini ) Databases - Normalization I 1 / 24
Databases -Normalization I (GF Royle, N Spadaccini 2006-2010) Databases - Normalization I 1 / 24 This lecture This lecture introduces normal forms, decomposition and normalization. We will explore problems
More informationFundamentals of Database Systems
Fundamentals of Database Systems Assignment: 3 Due Date: 23st August, 2017 Instructions This question paper contains 15 questions in 6 pages. Q1: Consider the following relation and its functional dependencies,
More informationHome Page. Title Page. Page 1 of 14. Go Back. Full Screen. Close. Quit
Page 1 of 14 A BCNF Normalisation Algorithm Input: A specification containing: 1. a relation schema, R, and 2. a set of Functional Dependencies (FDs), F over R. An Entity-relationship Diagram (ERD) conforming
More informationDatabase design III. Quiz time! Using FDs to detect anomalies. Decomposition. Decomposition. Boyce-Codd Normal Form 11/4/16
Lecture 3 Quiz time! Database design III Functional dependencies cont. BCNF and 3NF What s wrong with this schema? {(, 2, Databases, Steven Van Acker ), (, 4, Databases, Rogardt Heldal )} Redundancy! Using
More informationCombining schemas. Problems: redundancy, hard to update, possible NULLs
Handout Combining schemas Problems: redundancy, hard to update, possible NULLs Problems? Conclusion: Whether the join attribute is PK or not makes a great difference when combining schemas! Splitting schemas,
More information5 Normalization:Quality of relational designs
5 Normalization:Quality of relational designs 5.1 Functional Dependencies 5.1.1 Design quality 5.1.2 Update anomalies 5.1.3 Functional Dependencies: definition 5.1.4 Properties of Functional Dependencies
More informationChapter 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 informationPresentation on Functional Dependencies CS x265
Presentation on Functional Dependencies CS x265 This presentation assumes that you have previously viewed Watch videos (90 min) and answer questions from DB8 Relational Design Theory (https://class.stanford.edu/courses/db/rd/selfpaced/courseware/ch-relational_design_theory/)
More informationThis lecture. Databases -Normalization I. Repeating Data. Redundancy. This lecture introduces normal forms, decomposition and normalization.
This lecture Databases -Normalization I This lecture introduces normal forms, decomposition and normalization (GF Royle 2006-8, N Spadaccini 2008) Databases - Normalization I 1 / 23 (GF Royle 2006-8, N
More informationUnit IV. S_id S_Name S_Address Subject_opted
Page no: 1 Unit IV Normalization of Database Database Normalizations is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data
More informationChapter 16. Relational Database Design Algorithms. Database Design Approaches. Top-Down Design
Chapter 16 Relational Database Design Algorithms Database Design Approaches Top-Down design (Starting with conceptual design) Bottom-Up Design (relational synthesis) 2 Top-Down Design Design conceptual
More informationCS411 Database Systems. 05: Relational Schema Design Ch , except and
CS411 Database Systems 05: Relational Schema Design Ch. 3.1-3.5, except 3.4.2-3.4.3 and 3.5.3. 1 How does this fit in? ER Diagrams: Data Definition Translation to Relational Schema: Data Definition Relational
More informationRelational Database Design Theory. Introduction to Databases CompSci 316 Fall 2017
Relational Database Design Theory Introduction to Databases CompSci 316 Fall 2017 2 Announcements (Thu. Sep. 14) Homework #1 due next Tuesday (11:59pm) Course project description posted Read it! Mixer
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
CHAPTER 14 Basics of Functional Dependencies and Normalization for Relational Databases Slide 14-2 Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1 Semantics of the Relation Attributes
More informationcustomer = (customer_id, _ customer_name, customer_street,
Relational Database Design COMPILED BY: RITURAJ JAIN The Banking Schema branch = (branch_name, branch_city, assets) customer = (customer_id, _ customer_name, customer_street, customer_city) account = (account_number,
More informationHomework 6: FDs, NFs and XML (due April 13 th, 2016, 4:00pm, hard-copy in-class please)
Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Homework 6: FDs, NFs and XML (due April 13 th, 2016, 4:00pm, hard-copy in-class please) Reminders: a. Out of 100 points.
More informationChapter 10. Normalization. Chapter Outline. Chapter Outline(contd.)
Chapter 10 Normalization Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant Information in Tuples and Update Anomalies 1.3 Null
More informationUnit 3 : Relational Database Design
Unit 3 : Relational Database Design Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Content Relational Model: Basic concepts, Attributes and Domains, CODD's Rules, Relational
More informationLectures 12: Design Theory I. 1. Normal forms & functional dependencies 2/19/2018. Today s Lecture. What you will learn about in this section
Today s Lecture Lectures 12: Design Theory I Professor Xiannong Meng Spring 2018 Lecture and activity contents are based on what Prof Chris Ré used in his CS 145 in the fall 2016 term with permission 1.
More informationRelational Database Design (II)
Relational Database Design (II) 1 Roadmap of This Lecture Algorithms for Functional Dependencies (cont d) Decomposition Using Multi-valued Dependencies More Normal Form Database-Design Process Modeling
More informationSchema Refinement: Dependencies and Normal Forms
Schema Refinement: Dependencies and Normal Forms Grant Weddell David R. Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Spring 2012 CS 348 (Intro to
More informationLectures 5 & 6. Lectures 6: Design Theory Part II
Lectures 5 & 6 Lectures 6: Design Theory Part II Lecture 6 Today s Lecture 1. Boyce-Codd Normal Form ACTIVITY 2. Decompositions & 3NF ACTIVITY 3. MVDs ACTIVITY 2 Lecture 6 > Section 1 1. Boyce-Codd Normal
More informationSCHEMA REFINEMENT AND NORMAL FORMS
19 SCHEMA REFINEMENT AND NORMAL FORMS Exercise 19.1 Briefly answer the following questions: 1. Define the term functional dependency. 2. Why are some functional dependencies called trivial? 3. Give a set
More informationChapter 10. Chapter Outline. Chapter Outline. Functional Dependencies and Normalization for Relational Databases
Chapter 10 Functional Dependencies and Normalization for Relational Databases Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant
More informationTheory of Normal Forms Decomposition of Relations. Overview
.. Winter 2008 CPE/CSC 366: Database Modeling, Design and Implementation Alexander Dekhtyar.. Overview Theory of Normal Forms Decomposition of Relations Functional Dependencies capture the attribute dependencies
More informationExercise 9: Normal Forms
Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Eliza Last update:
More informationDesign Theory for Relational Databases
By Marina Barsky Design Theory for Relational Databases Lecture 15 Functional dependencies: formal definition X Y is an assertion about a relation R that whenever two tuples of R agree on all the attributes
More informationNormalisation. Normalisation. Normalisation
Normalisation Normalisation Main objective in developing a logical data model for relational database systems is to create an accurate and efficient representation of the data, its relationships, and constraints
More informationDatabase Management Systems (Classroom Practice Booklet Solutions)
Database Management Systems (Classroom Practice Booklet Solutions) 2. ER and Relational Model 4 ssn cid 01. Ans: (b) Professor Teaches course 02. Ans: (c) Sol: Because each patient is admitted into one
More informationPart V Relational Database Design Theory
Part V Relational Database Design Theory Relational Database Design Theory 1 Target Model of the Logical Design 2 Relational DB Design 3 Normal Forms 4 Transformation Properties 5 Design Methods Saake
More informationFunctional dependency theory
Functional dependency theory Introduction to Database Design 2012, Lecture 8 Course evaluation Recalling normal forms Functional dependency theory Computing closures of attribute sets BCNF decomposition
More informationLecture 6a Design Theory and Normalization 2/2
CompSci 516 Data Intensive Computing Systems Lecture 6a Design Theory and Normalization 2/2 Instructor: Sudeepa Roy 1 HW1 deadline: Announcements Due on 09/21 (Thurs), 11:55 pm, no late days Project proposal
More informationElmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2 Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant
More informationDatabase Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur
Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 19 Relational Database Design (Contd.) Welcome to module
More informationSchema Refinement: Dependencies and Normal Forms
Schema Refinement: Dependencies and Normal Forms Grant Weddell Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Spring 2016 CS 348 (Intro to DB Mgmt)
More informationDatabase Design Principles
Database Design Principles CPS352: Database Systems Simon Miner Gordon College Last Revised: 2/11/15 Agenda Check-in Design Project ERD Presentations Database Design Principles Decomposition Functional
More informationSample Exam for CSE 480 (2016)
Sample Exam for CSE 480 (2016) Answer the questions in the spaces provided on the page. If you run out of room for an answer, continue on the back of the page. Instructions: DO NOT START THE EXAM UNTIL
More informationFunctional Dependencies and. Databases. 1 Informal Design Guidelines for Relational Databases. 4 General Normal Form Definitions (For Multiple Keys)
1 / 13 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant d Information in Tuples and Update Anomalies 1.3 Null Values in Tuples 1.4 Spurious Tuples
More informationChapter 14. Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies
Chapter 14 Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies Copyright 2012 Ramez Elmasri and Shamkant B. Navathe Chapter Outline 1 Informal Design Guidelines
More informationSchema Refinement: Dependencies and Normal Forms
Schema Refinement: Dependencies and Normal Forms M. Tamer Özsu David R. Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Fall 2012 CS 348 Schema Refinement
More informationDatabase Management System
Database Management System Lecture 4 Database Design Normalization and View * Some materials adapted from R. Ramakrishnan, J. Gehrke and Shawn Bowers Today s Agenda Normalization View Database Management
More informationV. Database Design CS448/ How to obtain a good relational database schema
V. How to obtain a good relational database schema Deriving new relational schema from ER-diagrams Normal forms: use of constraints in evaluating existing relational schema CS448/648 1 Translating an E-R
More informationRelational Design Theory. Relational Design Theory. Example. Example. A badly designed schema can result in several anomalies.
Relational Design Theory Relational Design Theory A badly designed schema can result in several anomalies Update-Anomalies: If we modify a single fact, we have to change several tuples Insert-Anomalies:
More informationDatabases Lecture 7. Timothy G. Griffin. Computer Laboratory University of Cambridge, UK. Databases, Lent 2009
Databases Lecture 7 Timothy G. Griffin Computer Laboratory University of Cambridge, UK Databases, Lent 2009 T. Griffin (cl.cam.ac.uk) Databases Lecture 7 DB 2009 1 / 17 Lecture 07: Decomposition to Normal
More informationConcepts from
1 Concepts from 3.1-3.2 Functional dependencies Keys & superkeys of a relation Reasoning about FDs Closure of a set of attributes Closure of a set of FDs Minimal basis for a set of FDs 2 Plan How can we
More informationLecture 4. Database design IV. INDs and 4NF Design wrapup
Lecture 4 Database design IV INDs and 4NF Design wrapup Problem description We want a database that we can use for scheduling courses and lectures. This is how it s supposed to work: code name Course dept
More informationDatabase Design Theory and Normalization. CS 377: Database Systems
Database Design Theory and Normalization CS 377: Database Systems Recap: What Has Been Covered Lectures 1-2: Database Overview & Concepts Lecture 4: Representational Model (Relational Model) & Mapping
More informationDatabase Systems. Basics of the Relational Data Model
Database Systems Relational Design Theory Jens Otten University of Oslo Jens Otten (UiO) Database Systems Relational Design Theory INF3100 Spring 18 1 / 30 Basics of the Relational Data Model title year
More informationInformal Design Guidelines for Relational Databases
Outline Informal Design Guidelines for Relational Databases Semantics of the Relation Attributes Redundant Information in Tuples and Update Anomalies Null Values in Tuples Spurious Tuples Functional Dependencies
More informationHomework 3: Relational Database Design Theory (100 points)
CS 122A: Introduction to Data Management Spring 2018 Homework 3: Relational Database Design Theory (100 points) Due Date: Wed, Apr 25 (5:00 PM) Submission All HW assignments should be turned in with a
More informationRelational Design Theory
OpenStax-CNX module: m28252 1 Relational Design Theory Nguyen Kim Anh This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 3.0 Abstract One important theory
More informationSample Exam for CSE 480 (2017) KEY
Sample Exam for CSE 480 (2017) KEY Answer the questions in the spaces provided on the page. If you run out of room for an answer, continue on the back of that page. Instructions: DO NOT START THE EXAM
More informationFunctional Dependencies & Normalization for Relational DBs. Truong Tuan Anh CSE-HCMUT
Functional Dependencies & Normalization for Relational DBs Truong Tuan Anh CSE-HCMUT 1 2 Contents 1 Introduction 2 Functional dependencies (FDs) 3 Normalization 4 Relational database schema design algorithms
More informationHomework 6. Question Points Score Query Optimization 20 Functional Dependencies 20 Decompositions 30 Normal Forms 30 Total: 100
Carnegie Mellon University Department of Computer Science 15-415/615- Database Applications C. Faloutsos & A. Pavlo, Spring 2015 Prepared by Vinay & Jiayu DUE DATE: Tuesday, 3/24/2015, 1:30pm Homework
More information18. Relational Database Design
18. Relational Database Design The relational datamodel was introduced by Codd in 1970. It is the most widely used datamodel extended with the possibilities of the World Wide Web, because of its simplicity
More informationIn This Lecture. Normalisation to BCNF. Lossless decomposition. Normalisation so Far. Relational algebra reminder: product
In This Lecture Normalisation to BCNF Database Systems Lecture 12 Natasha Alechina More normalisation Brief review of relational algebra Lossless decomposition Boyce-Codd normal form (BCNF) Higher normal
More informationFunctional Dependencies and Normalization for Relational Databases Design & Analysis of Database Systems
Functional Dependencies and Normalization for Relational Databases 406.426 Design & Analysis of Database Systems Jonghun Park jonghun@snu.ac.kr Dept. of Industrial Engineering Seoul National University
More informationDatabase Constraints and Design
Database Constraints and Design We know that databases are often required to satisfy some integrity constraints. The most common ones are functional and inclusion dependencies. We ll study properties of
More informationEuclid. Father of Geometry Euclidean Geometry Euclid s Elements
Euclid Father of Geometry Euclidean Geometry Euclid s Elements Point Description Indicates a location and has no size. How to Name it You can represent a point by a dot and name it by a capital letter.
More informationCS 338 Functional Dependencies
CS 338 Functional Dependencies Bojana Bislimovska Winter 2016 Outline Design Guidelines for Relation Schemas Functional Dependency Set and Attribute Closure Schema Decomposition Boyce-Codd Normal Form
More informationCS352 Lecture - Conceptual Relational Database Design
CS352 Lecture - Conceptual Relational Database Design Objectives: last revised September 20, 2006 1. To define the concepts functional dependency and multivalued dependency 2. To show how to find the closure
More informationSchema Normalization. 30 th August Submitted By: Saurabh Singla Rahul Bhatnagar
Schema Normalization 30 th August 2011 Submitted By: Saurabh Singla 09010146 Rahul Bhatnagar 09010136 Normalization Consider the following ER diagram with some FD: Instructor iid A Student sid Department
More informationLecture 11 - Chapter 8 Relational Database Design Part 1
CMSC 461, Database Management Systems Spring 2018 Lecture 11 - Chapter 8 Relational Database Design Part 1 These slides are based on Database System Concepts 6th edition book and are a modified version
More informationHomework 6: FDs, NFs and XML (due April 15 th, 2015, 4:00pm, hard-copy in-class please)
Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Homework 6: FDs, NFs and XML (due April 15 th, 2015, 4:00pm, hard-copy in-class please) Reminders: a. Out of 100 points.
More informationCS352 Lecture - Conceptual Relational Database Design
CS352 Lecture - Conceptual Relational Database Design Objectives: last revised September 16, 2004 1. To define the concepts functional dependency and multivalued dependency 2. To show how to find the closure
More informationNormalization. Anomalies Functional Dependencies Closures Key Computation Projecting Relations BCNF Reconstructing Information Other Normal Forms
Anomalies Functional Dependencies Closures Key Computation Projecting Relations BCNF Reconstructing Information Other Normal Forms Normalization Niklas Fors (niklas.fors@cs.lth.se) Normalization 1 / 45
More informationFrom Murach Chap. 9, second half. Schema Refinement and Normal Forms
From Murach Chap. 9, second half The need for normalization A table that contains repeating columns Schema Refinement and Normal Forms A table that contains redundant data (same values repeated over and
More informationAlternate Exam for CSE 480 (2017) KEY
Alternate Exam for CSE 480 (2017) KEY Answer the questions in the spaces provided on the page. If you run out of room for an answer, continue on the back of that page. Instructions: DO NOT START THE EXAM
More informationAnnouncements (January 20) Relational Database Design. Database (schema) design. Entity-relationship (E/R) model. ODL (Object Definition Language)
Announcements (January 20) 2 Relational Database Design Review for Codd paper due tonight via email Follow instructions on course Web site Reading assignment for next week (Ailamaki et al., VLDB 2001)
More informationNormalization is based on the concept of functional dependency. A functional dependency is a type of relationship between attributes.
Lecture Handout Database Management System Lecture No. 19 Reading Material Database Systems Principles, Design and Implementation written by Catherine Ricardo, Maxwell Macmillan. Section 7.1 7.7 Database
More informationRelational Database Design. Announcements. Database (schema) design. CPS 216 Advanced Database Systems. DB2 accounts have been set up
Relational Database Design CPS 216 Advanced Database Systems Announcements 2 DB2 accounts have been set up Let me know if you have not received an email from me regarding your account Recitation session
More informationCS x265 Exam 3 Spring ALL questions 5 points, except question 11 I will not use a source other than my brain on this exam: (please sign)
CS x265 Exam 3 Spring 2017 Name: KEY ALL questions 5 points, except question 11 I will not use a source other than my brain on this exam: (please sign) 1. (5 points) Consider the following definitions,
More informationIntroduction to Database Design, fall 2011 IT University of Copenhagen. Normalization. Rasmus Pagh
Introduction to Database Design, fall 2011 IT University of Copenhagen Normalization Rasmus Pagh Based on KBL sections 6.1-6.8 (except p. 203 207m), 6.9 (until Multivalued dependencies ), 6.11, and 6.12.
More informationDatabases The theory of relational database design Lectures for m
Databases The theory of relational database design Lectures for mathematics students April 2, 2017 General introduction Look; that s why there s rules, understand? So that you think before you break em.
More informationDatabase Normalization. (Olav Dæhli 2018)
Database Normalization (Olav Dæhli 2018) 1 What is normalization and why normalize? Normalization: A set of rules to decompose relations (tables) into smaller relations (tables), without loosing any data
More informationChapter 7: Relational Database Design
Chapter 7: Relational Database Design Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 7: Relational Database Design Features of Good Relational Design Atomic Domains
More informationJordan University of Science & Technology Computer Science Department CS 728: Advanced Database Systems Midterm Exam First 2009/2010
Jordan University of Science & Technology Computer Science Department CS 728: Advanced Database Systems Midterm Exam First 2009/2010 Student Name: ID: Part 1: Multiple-Choice Questions (17 questions, 1
More information(At most 8 combina7ons of B,C,D composite values) AND (BCDà E) means (At most 8 values for E)
Study group exercises In a3endance: KEY 1. Suppose you have a rela=on P ( A, B, C, D, E, F ), with func=onal dependencies (FDs) A à B, BCD à E, E à F Suppose there are at most 2 different possible values
More informationMore Normalization Algorithms. CS157A Chris Pollett Nov. 28, 2005.
More Normalization Algorithms CS157A Chris Pollett Nov. 28, 2005. Outline 3NF Decomposition Algorithms BCNF Algorithms Multivalued Dependencies and 4NF Dependency-Preserving Decomposition into 3NF Input:
More informationFunctional Dependencies and Normalization
Functional Dependencies and Normalization Jose M. Peña jose.m.pena@liu.se Overview Real world Databases DBMS Model Physical database Queries Processing of queries and updates Access to stored data Answers
More informationHandout 3: Functional Dependencies and Normalization
Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Handout 3: Functional Dependencies and Normalization Q1: Inferring FDs Consider the following schemas and sets of functional
More informationChapter 14 Outline. Normalization for Relational Databases: Outline. Chapter 14: Basics of Functional Dependencies and
Ramez Elmasri, Shamkant B. Navathe(2016) Fundamentals of Database Systems (7th Edition), pearson, isbn 10: 0-13-397077-9;isbn-13:978-0-13-397077-7. Chapter 14: Basics of Functional Dependencies and Normalization
More information