ID: 127180
Download Pdf The PPT/PDF document "Normalisation to 3NFDatabase Systems Lec..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Normalisation to 3NFDatabase Systems Lecture 11Natasha Alechina Normalisation to 3NFData redundancyFunctional dependenciesNormal formsFirst, Second, and Third Normal FormsFor more informationConnolly and Beggchapter 13Ullmanand Widomch.3.6.6 (2 Redundant dataCan be determined Leads to various INSERT anomaliesUPDATE anomaliesDELETE anomaliesNormalisationAims to reduce data Redundancy is Normal forms are In most definitions All data values should This means that table A relation is said to Normalisation to 1NFUnnormalisedModule Dept Lecturer TextsM2 D1 L1 T1, T3 1NFModule Dept Lecturer TextM1 D1 L1 T1M1 D1 L1 T2 To convert to a 1NF relation, split up any non-atomic values INSERT anomaliesCan't add a module UPDATE anomaliesTo change lecturer for DELETE anomaliesIf we remove M3, we Redundancy is often A functional dependency We can normalise a A set of attributes, A, between A {ID, modCode} {modCode} {ID} IDmodCodemodNameFirstLast 111G51PRGProgrammingJoeBloggs222G51DBSDatabasesAnneSmith FDsand NormalisationWe define a set of Each normal form has fewer FDsthan the Since FDsrepresent Not all FDscause a We identify various Each normal form We will also need a In any relationThe primary key FDsis the primary key, Same for candidate Any set of attributes Rules for FDsReflexivity: If Augmentation: If Transitivity: The primary key is 'Trivial' FDs, eg:{Module} Other FDsare{Module} {Module} {Dept}{Lecturer} {Dept}These are non-trivial Partial FDsand 2NFPartial FDs:A FD, is a partial Formally, there is some Let us call attributes A relation is in second In other words, no 1NF is not in 2NFWe have the FDBut alsoAnd so Lecturer and Suppose we have a Let C = S (A U B)In other words:A attributes on the left B attributes on the C all other attributesIt turns out that we can R1, with scheme C U AR2, with scheme A U BThe original relation can R = R1 NATURAL JOIN R2 1NF to 2NF Example 2NFaModule Dept LecturerM1 D1 L1M2 D1 L1 2NFbModule TextM1 T1M1 T2 Problems in 1NFINSERT Can't add a UPDATE To change DELETE If we In 2NF the first two INSERT anomaliesCan't add lecturers UPDATE anomaliesTo change the DELETE anomaliesIf we delete M3 we Transitive FDsand 3NFTransitive FDs:A FD, We haveThird normal form A relation is in third 2NFa is not in 3NFWe have the FDs{Lecturer}{Dept}So there is a primary key {Module} 2NF to 3NF Example 3NFaLecturer DeptL1 D1L2 D1 3NFbModule LecturerM1 L1M2 L1 Problems in 2NFINSERT Can't add UPDATE To change DELETE If we delete In 3NF all of these are resolved (for this relation anomalies!) 3NFbModule LecturerM1 L1M2 L1 Normalisation is A database should If your design leads to When you find you Identify the FDsthat Think if they will lead Try to remove them More normalisationLossless decomposition; why our reduction Boyce-Coddnormal form (BCNF)Higher normal formsDenormalisationFor more informationConnolly and Beggchapter 14Ullmanand Widomchapter 3.6