You are on page 1of 3

Normalisation Example


Student Example
The following table depicts the set of attribute found in a University database:
Student-No Student-Name Course-Code Course-Length 001 00! Smith Soap A 0! A10" ! "

(yrs) Unit-Code Unit-Name

U"# U$% U$+ U"# U # U1 U"+ U1 U$+


&atabases '' )rown (rogramming *reen Algorithms (urple &atabases '' )rown )usiness ' ,ed )usiness '' &atabases ' )usiness '' Algorithms (in. /range (in. (urple

00% 010

-ho 0emon

A 0! A! !

Notes: A student attends one course and can ta.e any units during the course1 A unit may be presented as part of any course and is always given by one particular lecturer1 2ou are re3uired to show the first4 second and third normal forms1 56plain the normalisation process used1

Ans er
!irst Normal !orm
7,emove repeating groups7 11 The attribute chosen as the primary .ey is student-no1 1 The set of attributes which repeat for each value of student-no are unit-code4 unitname4 and lecturer1 !1 ,emoving these attributes from the full attribute set produces the relation: (student8no4 student8name4 course8code4 course8length) "1 The primary .ey is student-no1 (student8no4 student8name4 course8code4 course8length) #1 The primary .ey for the repeating group is unit-code1 This is because for each student_no the unit-code uni3uely identifies the unit-name and lecturer attributes1

9or e6ample4 for student 0014 unit U"# is always :&atabases '': and the lecturer is always :)rown:1 +1 The new relation is: (student8no4 unit8code4 unit8name4 lecturer) %1 The attribute unit-code is not uni3ue in this relation and so the .ey of this relation is (student8no4 unit8code)1 (student8no4 unit8code4 unit8name4 lecturer) $1 There are no more repeating groups1 The first normal form relations are: student1(student8no4 student8name4 course8code4 course8length) ta.es1(student8no4 unit8code4 unit8name4 lecturer)

Second Normal !orm

7,emove partial dependencies7 The student1 relation does not have a composite primary .ey and4 therefore4 cannot contain partial dependencies1 The takes1 relation has the following dependencies: student8no4 unit8code 8; unit8name4 lecturer The primary .ey determines all attributes1 unit8code 8;unit8name 5ach unit has a name1 unit8code 8; lecturer 5ach unit is taught by the same lecturer1 Therefore4 a partial dependency e6ists between unit-code and unit-name and lecturer1 ,emoving the partial dependencies from takes1 (but not changing the .ey of takes1) produces the relations: (student8no4 unit8code) unit (unit8code4 unit8name4 lecturer) The second normal form relations are: student (student8no4 student8name4 course8code4 course8length) (student8no4 unit8code) unit (unit8code4 unit8name4 lecturer)

"hird Normal !orm

7,emove transitive dependencies7 The student2 relation has the following functional dependencies: student8no 8; student8name4 course8code4 course8length course8code 8; course8length The primary .ey determines all attributes1 The course length is determined by the course1

Therefore4 the following transitive dependency e6ists: student8no 8; course8code 8; course8length ,emoving this transitive dependency from student2 produces the following relations: student!(student8no4 student8name4 course8code) course!(course8code4 course8length) The takes2 relation contains no non8.ey attributes and so contains no transitive dependencies1 The unit2 relation contains the following dependencies: unit8code 8; unit8name4 lecturer The primary .ey determines all attributes1 Therefore4 there are no transitive dependencies in unit21 The set of third normal form relations are: student!(student8no4 student8name4 course8code) course!(course8code4 course8length)!(student8no4 unit8code) unit!(unit8code4 unit8name4 lecturer)