150 likes | 328 Views
First normal form. The intersection of each row and column contains one and only one value No multivalued attributes Two approaches to normalisation Flatten by duplicating non repeating data Put repeated data into a separate relation. Id. Name. Add. DOB. ModId. Mark. Desc. 1. BB.
E N D
First normal form • The intersection of each row and column contains one and only one value • No multivalued attributes • Two approaches to normalisation • Flatten by duplicating non repeating data • Put repeated data into a separate relation CM205-6
Id Name Add DOB ModId Mark Desc 1 BB 2918 3/3/77 cm141 cm142 7 6 CSA adv prog CM205-6
STUDENT ENROL CM205-6
Normalization • Anomalies caused by redundant data • Insertion, deletion, modification • Certain functional dependencies cause anomalies • Normalization breaks a relation into two or more relations removing the undesirable functional dependencies CM205-6
Videotape : ( videoid, datePurchased,title, genre, length) CM205-6
Anomalies • Insertion of a new copy of “Sooty” means we must check that the details are consistent • Changing length of “Sooty” must be done on all videos of “Sooty” • Deleting the last copy of Sooty means the information on the movie is also lost CM205-6
Functional dependency • Describes the relationships between attributes in a relation from their semantics • If A and B are attributes (or sets of attributes) of a relation R. B is functionally dependent on A if every value of A determines a unique value of B CM205-6
Video example The second dependency is that between non key attributes, indirect key dependency If we locate this dependency in our relation, it will imply the problems we have described CM205-6
Second Normal Form Full functional dependency: B is fully functionally dependent on A if B is functionally dependent on A, but not on any proper subset of A Second Normal Form: First normal form and every non-primary key attribute is fully functionally dependent on the primary key CM205-6
In ENROLMOD Not in 2NF. Partial key dependency. Create a new relation from the partial key dependency. Remove the attributes in the range from first relation. CM205-6
Third Normal Form Transitive dependency Third normal form 2NF and no transitive dependency CM205-6
Video example Not in 3NF. Define a new relation from the transitively dependent attributes CM205-6