Presentation is loading. Please wait.

Presentation is loading. Please wait.

University of Sunderland COMM2Q Unit 2 COMM2Q Lecture 2 HIS Application Building.

Similar presentations


Presentation on theme: "University of Sunderland COMM2Q Unit 2 COMM2Q Lecture 2 HIS Application Building."— Presentation transcript:

1 University of Sunderland COMM2Q Unit 2 COMM2Q Lecture 2 HIS Application Building

2 University of Sunderland COMM2Q Unit 2 2 An Introduction to Relational Data Analysis (Normalisation)

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

4 University of Sunderland COMM2Q Unit 2 Relational Data Analysis Student Results Table

5 University of Sunderland COMM2Q Unit 2 Relational Data Analysis Possible Entities in System COURSECOURSE STUDENTSTUDENT TUTORTUTOR GRADE?GRADE?

6 University of Sunderland COMM2Q Unit 2 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

7 University of Sunderland COMM2Q Unit 2 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 CodeTutor Code Tutor NameTutor Name GradeGrade ResultResult

8 University of Sunderland COMM2Q Unit 2 8 UNFUNF1NF2NF3NF LEVEL Course Code1 Course Title1 Student Code2 Student Name2 Date of Birth2 Tutor Code 2 Tutor Name2 Grade2 Result2 Relational Data Analysis Normalisation Table

9 University of Sunderland COMM2Q Unit 2 9 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

10 University of Sunderland COMM2Q Unit 2 10 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

11 University of Sunderland COMM2Q Unit 2 11 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

12 University of Sunderland COMM2Q Unit 2 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 University of Sunderland COMM2Q Unit 2 13 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

14 University of Sunderland COMM2Q Unit 2 14 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

15 University of Sunderland COMM2Q Unit 2 Relational Data Analysis Student CodeStudent Name Student Code Tutor Code Course Code

16 University of Sunderland COMM2Q Unit 2 Relational Data Analysis Student Name Date of Birth Course CodeTutor Code Student CodeTutor Name Grade Result

17 University of Sunderland COMM2Q Unit 2 17 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

18 University of Sunderland COMM2Q Unit 2 18 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

19 University of Sunderland COMM2Q Unit 2 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 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

20 University of Sunderland COMM2Q Unit 2 20 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

21 University of Sunderland COMM2Q Unit 2 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

22 University of Sunderland COMM2Q Unit 2 Normalisation Constructing a Data Model from 3NF

23 University of Sunderland COMM2Q Unit 2 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

24 University of Sunderland COMM2Q Unit 2 Student Results Relations

25 University of Sunderland COMM2Q Unit 2 Create an entity type for each data relation e.g. COURSE Course Code COURSE-STUDENT Course Code Student Code *Tutor Code *Grade

26 University of Sunderland COMM2Q Unit 2 Make compound key relations into details refers to master / detail relationship COURSESTUDENT COURSE- STUDENT Course Code Student Code Course CodeStudent Code

27 University of Sunderland COMM2Q Unit 2 Make relations with foreign keys into details COURSESTUDENT COURSE- STUDENT Course Code Student Code *Tutor Code *Grade Course CodeStudent Code TUTORGRADE Tutor CodeGrade

28 University of Sunderland COMM2Q Unit 2 Redrawn Entity Model COURSESTUDENT COURSE- STUDENT Course Code Student Code *Tutor Code *Grade Course CodeStudent Code TUTOR GRADE Tutor Code Grade

29 University of Sunderland COMM2Q Unit 2 Example 2

30 University of Sunderland COMM2Q Unit 2 Rule 1 Create an entity type for each data relation e.g. COURSE Course Code COURSE-STUDENT Course Code Student Code

31 University of Sunderland COMM2Q Unit 2 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

32 University of Sunderland COMM2Q Unit 2 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)

33 University of Sunderland COMM2Q Unit 2 Rule 4 Make compound key relations into details refers to master / detail relationship COURSESTUDENT COURSE- STUDENT Course Code Student Code Course CodeStudent Code

34 University of Sunderland COMM2Q Unit 2 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

35 University of Sunderland COMM2Q Unit 2 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

36 University of Sunderland COMM2Q Unit 2 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 "University of Sunderland COMM2Q Unit 2 COMM2Q Lecture 2 HIS Application Building."

Similar presentations


Ads by Google