Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 An Introduction to Relational Data Analysis (Normalisation)

Similar presentations


Presentation on theme: "1 An Introduction to Relational Data Analysis (Normalisation)"— Presentation transcript:

1 1 An Introduction to Relational Data Analysis (Normalisation)

2 2 Steps in Normalisation 1.Un-normalised form 2.First Normal Form 3.Second Normal Form 4.Third Normal Form Relational Data Analysis

3 3 Relational Data Analysis Student Results Table

4 4 Relational Data Analysis Possible Entities in System COURSECOURSE STUDENTSTUDENT TUTORTUTOR GRADE?GRADE?

5 5 Relational Data Analysis Unnormalised Form: Table made up of ROWS and COLUMNSTable made up of ROWS and COLUMNS Rows grouped togetherRows grouped together Write table in unnormalised formWrite table in unnormalised form Choose unique KEY and underlineChoose unique KEY and underline

6 6 Relational Data Analysis Data Attributes Student CodeStudent Code Student NameStudent Name Date of BirthDate of Birth All REPEAT for a given value of COURSE CODE Tutor Code Tutor Code Tutor Name Tutor Name Grade Grade Result Result

7 7 UNFUNF1NF2NF3NF LEVEL Course Code1 Course Title1 Student Code2 Student Name2 Date of Birth2 Tutor Code2 Tutor Name2 Grade2 Result2 Relational Data Analysis Normalisation Table

8 8 Any relation is in First Normal Form when it contains no repeating groups of dataAny relation is in First Normal Form when it contains no repeating groups of data Relational Data Analysis First Normal Form

9 9 UNFUNF1NF2NF3NF LEVEL Course Code1 Course Code Course Title1 Course Title Student Code 2 Student Name2Course Code Date of Birth2 Student Code Tutor Code2Student Name Tutor Name2 Date of Birth Grade2 Tutor Code Result2Tutor Name Grade Result Relational Data Analysis Normalisation Table

10 10 Relational Data Analysis Normalisation Table UNFUNF1NF2NF3NF LEVEL Course Code 1Course Code Course Title 1Course Title Student Code 2 Student Name 2 Date of Birth 2 Tutor Code 2Course Code Tutor Name 2Student Code Grade 2Student Name Result2Date of Birth Tutor Code Tutor Name Grade Result

11 11 Relational Data Analysis Normalisation Table UNFUNF1NF2NF3NF LEVEL Course Code1Course Code Course Title1Course Title Student Code2 Student Name2 Date of Birth2 Tutor Code2Course Code Tutor Name2Student Code Grade 2Student Name Result 2Date of Birth Tutor Code Tutor Name Grade Result

12 12 Relational Data Analysis Normalisation Table UNFUNF1NF2NF3NF LEVEL Course Code1Course Code Course Title1Course Title Student Code2 Student Name2 Date of Birth2 Tutor Code2Course Code Tutor Name2Student Code Grade 2Student Name Result 2Date of Birth Tutor Code Tutor Name Grade Result

13 13 Any relation already in 1NF is also in 2NF if EITHER the key is a single attribute OR the non-key items are fully dependent on the WHOLE keyAny relation already in 1NF is also in 2NF if EITHER the key is a single attribute OR the non-key items are fully dependent on the WHOLE key In Second Normal Form, you remove data items which depend on only part of a keyIn Second Normal Form, you remove data items which depend on only part of a key Relational Data Analysis Second Normal Form

14 14 Relational Data Analysis Student CodeStudent Name Student Code Tutor Code Course Code

15 15 Relational Data Analysis Student Name Date of Birth Course CodeTutor Code Student CodeTutor Name Grade Result

16 16 UNFUNF1NF2NF3NF LEVEL Course Code1 Course Code Course Code Course Title1 Course Title Course Title Student Code 2 Student Name2Course CodeCourse Code Date of Birth2 Student CodeStudent Code Tutor Code2Student NameTutor Code Tutor Name2 Date of BirthTutor Name Grade2 Tutor CodeGrade Result2Tutor NameResult Grade ResultStudent Code Student Name Date of Birth Relational Data Analysis Normalisation Table - 2NF

17 17 Any relation in 2NF is also 3NF if all non-key attributes are independent of all other non-key attributes and all key attributes are independent of all the other key attributesAny relation in 2NF is also 3NF if all non-key attributes are independent of all other non-key attributes and all key attributes are independent of all the other key attributes In Third Normal Form, you remove any attributes which are not directly dependentupon the keyIn Third Normal Form, you remove any attributes which are not directly dependentupon the key Relational Data Analysis Third Normal Form

18 18 UNFUNF1NF2NF3NF LEVEL Course Code1 Course Code Course CodeCourse Code Course Title1 Course Title Course TitleCourse Title Student Code 2 Student Name2Course CodeCourse CodeCourse Code Date of Birth2 Student CodeStudent CodeStudent Code Tutor Code2Student NameTutor CodeTutor Code Tutor Name2 Date of BirthTutor NameGrade Grade2 Tutor CodeGrade Result2Tutor NameResultStudent Code GradeStudent Name ResultStudent CodeDate of Birth Student Name Date of BirthTutor Code Tutor Name Grade Result Relational Data Analysis Normalisation Table - 3NF

19 19 UNFUNF1NF2NF3NF LEVEL Course Code1 Course Code Course CodeCourse Code Course Title1 Course Title Course TitleCourse Title Student Code 2 Student Name2Course CodeCourse CodeCourse Code Date of Birth2 Student CodeStudent CodeStudent Code Tutor Code2Student NameTutor Code*Tutor Code Tutor Name2 Date of BirthTutor Name*Grade Grade2 Tutor CodeGrade Result2Tutor NameResultStudent Code GradeStudent Name ResultStudent CodeDate of Birth Student Name Date of BirthTutor Code Tutor Name Grade Result Relational Data Analysis Normalisation Table - 3NF Foreign key

20 20 Relational Data Analysis Summary: Choose a suitable key from a table of raw dataChoose a suitable key from a table of raw data Identify repeating groupsIdentify repeating groups Write the data in unnormalised formWrite the data in unnormalised form Convert unnormalised data to first normal formConvert unnormalised data to first normal form Convert first normal form to second normal formConvert first normal form to second normal form Convert second normal form to third normal formConvert second normal form to third normal form

21 21 Normalisation Constructing a Data Model from 3NF

22 22 UNFUNF1NF2NF3NF LEVEL Course Code1 Course Code Course CodeCourse Code Course Title1 Course Title Course TitleCourse Title Student Code 2 Student Name2Course CodeCourse CodeCourse Code Date of Birth2 Student CodeStudent CodeStudent Code Tutor Code2Student NameTutor Code*Tutor Code Tutor Name2 Date of BirthTutor Name*Grade Grade2 Tutor CodeGrade Result2Tutor NameResultStudent Code GradeStudent Name ResultStudent CodeDate of Birth Student Name Date of BirthTutor Code Tutor Name Grade Result Normalisation Table - 3NF Foreign key

23 23 Student Results Relations

24 24 Create an entity type for each data relation e.g. COURSE Course Code COURSE-STUDENT Course Code Student Code *Tutor Code *Grade

25 25 Make compound key relations into details refers to master / detail relationship COURSESTUDENT COURSE- STUDENT Course Code Student Code Course CodeStudent Code

26 26 Make relations with foreign keys into details COURSESTUDENT COURSE- STUDENT Course Code Student Code *Tutor Code *Grade Course CodeStudent Code TUTORGRADE Tutor CodeGrade

27 27 Redrawn Entity Model COURSESTUDENT COURSE- STUDENT Course Code Student Code *Tutor Code *Grade Course CodeStudent Code TUTOR GRADE Tutor Code Grade

28 28 Example 2

29 29 Rule 1 Create an entity type for each data relation e.g. COURSE Course Code COURSE-STUDENT Course Code Student Code

30 30 Rule 2 Mark the qualifying elements of hierarchic keys as a foreign key hierarchic key in this example ASSIGNMENT *(Course Code) (Ass. Number) Rule 2

31 31 Rule 3 Check that all masters of compound key relations are present This example has two compound keys one made from simple key and hierarchic key one made from two simple keys COURSE-STUDENT Course Code Student Code RESULT Student Code (Course Code) (Ass. Number)

32 32 Rule 4 Make compound key relations into details refers to master / detail relationship COURSESTUDENT COURSE- STUDENT Course Code Student Code Course CodeStudent Code

33 33 Rule 4 Make compound key relations into details refers to master / detail relationship COURSESTUDENT COURSE- STUDENT Course Code Student Code Course CodeStudent Code ASSIGNMENT RESULT *(Course Code) (Ass. Number) Student Code (Course Code) (Ass. Number) Rule 4

34 34 Rule 5 COURSE STUDENT COURSE- STUDEN T Course Code Student Code Course Code Student Code ASSIGNMENT RESULT *(Course Code) (Ass. Number) Student Code (Course Code) (Ass. Number) Make relations with foreign keys into details Rule 5 Rule 2

35 35 3NF Model COURSE STUDENT COURSE- STUDENT Course Code Student Code Course Code Student Code ASSIGNMENT RESULT *(Course Code) (Ass. Number) Student Code (Course Code) (Ass. Number) Rule 4 Rule 5 Rule 2


Download ppt "1 An Introduction to Relational Data Analysis (Normalisation)"

Similar presentations


Ads by Google