Upcoming SlideShare
×

# D I T211 Chapter 6

2,897 views

Published on

Published in: Technology
1 Comment
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• The materials are very useful. I feel fellow teachers should use them and enrich there understanding to help the leaners and they can also refer the learners to these resources to help them get there own information to encourage research work at an early stage.

Are you sure you want to  Yes  No
Views
Total views
2,897
On SlideShare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
0
1
Likes
1
Embeds 0
No embeds

No notes for slide

### D I T211 Chapter 6

1. 1. CHAPTER 6 NORMALIZATION
2. 2. NORMALIZATION <ul><li>6.1 RELATIONAL DATA MODEL </li></ul><ul><li>6.1.1 What is relation? </li></ul><ul><li>6.1.2 A Notation of Relation </li></ul><ul><li>6.1.3 Problems in Relational Data Model </li></ul><ul><li>6.2 Normalization </li></ul><ul><ul><li>6.2.1 Definition of Normalization </li></ul></ul><ul><ul><li> 6.2.2 Purpose of Normalization </li></ul></ul><ul><ul><li> 6.2.3 Level of Normalization </li></ul></ul><ul><ul><li>6.2.4 Steps in Normalization </li></ul></ul>
3. 3. OBJECTIVE <ul><li>Define relation and discuss its notation and relational schema. </li></ul><ul><li>Recognize problems in designing relational data model. </li></ul><ul><li>Define normalization and the relative level of normalization. </li></ul><ul><li>Identify the steps in normalization. </li></ul><ul><li>To normalize an un-normalized data model </li></ul>
4. 4. RELATIONAL DATA MODEL <ul><li>Relation – A two dimensional table with columns and rows. </li></ul>Table 6.1: Relational Table
5. 5. NOTATION OF RELATION <ul><li>Relation Schema- list of attributes and their corresponding domains. </li></ul><ul><li>Format: </li></ul>Relation_Name (Primary_key, Non_Key_Attribute)
6. 6. Relation Schema?
7. 8. Table 6-6 The BOOK Table ccccccc ccccccc No 80.00 Graphic M-G1 Graphic Design P08 44444 44444 No 88.00 Multimedia M-G1 Adobe Illustrator 10 P07 33333 33333 No 40.00 Pengetahuan Am F-B1 Pengajian Malaysia P06 22222 22222 No 69.00 Database T-H1 Database Processing P05 11111 11111 No 59.00 Database T-H1 Microsoft Access 2000 Complete P04 zzzzz zzzzz No 100.00 Database P-H1 Concepts of Database Management System P03 yyyyy yyyyy No 80.00 Database M-G1 Teach Yourself Microsoft Access 2000 Visually P02 xxxxx xxxxx Yes 76.00 Database M-G1 Access 2000 Processing P01 Book_Cover Book_ Sample Price Type Publisher_Code Book_Title Book_ Code
8. 9. PROBLEM in RELATIONAL DATA MODEL <ul><li>There are 2 problem: </li></ul><ul><li>1. Anomalies </li></ul><ul><li>2. Information Redundancy </li></ul>
9. 10. ANOMALIES <ul><li>Errors or inconsistencies when user update a table that contains redundant data. </li></ul><ul><li>3 types of anomalies: </li></ul><ul><li>(i) Modification Anomalies </li></ul><ul><li>(ii) Insert Anomalies </li></ul><ul><li>(iii) Delete Anomalies </li></ul>
10. 11. MODIFICATION ANOMALIES Table 6-7 STUDENT_COURSE Table Diploma in Computer Graphic and Design. DIPCGR Jalan Puchong Syed Ahmad Rizal B. Syed Abdul Razak S0035 Computer Power 200 (Graphic and Multimedia) CGMP200 Tmn. Melawati Aidil Akmar Hj. Ayob S0159 Computer power 100 (IT) CITP100 Tmn. Koperasi Polis Nurazean Bt. Md. Sobri S0157 Computer Power 200 (Graphic and Multimedia) CGMP200 Bandar Baru Bangi Amjadi Abd. Mubin S0149 Associate Diploma in Interactive Multimedia ASDIM Jln. Kg. Gajah Hamizah Mohamed Redzwan S0144 Course_Name Course_ Code Address Student_Name Student_ID
11. 12. MODIFICATION ANOMALIES <ul><li>Problem? </li></ul><ul><li>Changing the data of a record may causing changing the data of a few records. </li></ul><ul><li>Solution? </li></ul><ul><li>Separate STUDENT_COURSE table into TWO tables. </li></ul>
12. 14. INSERT ANOMALIES
13. 15. INSERT ANOMALIES <ul><li>Problem? </li></ul><ul><li>Confusing error in adding new record with null primary key may happen. </li></ul><ul><li>Solution? </li></ul><ul><li>Separate STUDENT_COURSE table into TWO tables. </li></ul>
14. 17. DELETE ANOMALIES
15. 18. DELETE ANOMALIES <ul><li>Problem? </li></ul><ul><li>Deletion of one record can cause the table provide insufficient information. </li></ul><ul><li>Solution? </li></ul><ul><li>Separate STUDENT_COURSE table into TWO tables. </li></ul>
16. 20. INFORMATION REDUNDANCIES <ul><li>Duplication because of storing the same data multiple times. </li></ul>
17. 21. <ul><li>Problem? </li></ul><ul><li>In the STUDENT_SUBJECT table there is redundant information. It shows that the details of subject ADM101 (Internet Publishing) are repeated for every member of Student_ID enrolled for that subject. </li></ul><ul><li>Solution? </li></ul><ul><li>Separate the STUDENT_SUBJECT table into THREE Tables. </li></ul>INFORMATION REDUNDANCIES
18. 22. INFORMATION REDUNDANCIES The STUDENT_SUBJECT Table The SUBJECT Table The STUDENT Table Jalan Puchong Syed Ahmad Rizal B. Syed Abdul Razak S0035 Tmn. Melawati Aidil Akmar Hj. Ayob S0159 Tmn. Koperasi Polis Norazean Bt Md Sobri S0157 Bandar Baru Bangi Amjadi Abd Mubin S0149 Jln. Kg. Gajah Hamizah Mohamed Redzwan S0144 Address Student_Name Student_ID ADM101 S0035 ADM301 S0159 ADM101 S0157 ADM101 S0149 ACT410 S0144 Subject _code Student_ID 4 Project ADM301 4 Internet Publishing ADM101 4 Computerized Accounting ACT410 Credit_hour Subject_name Subject_code
19. 23. NORMALIZATION <ul><li>Definition - Process for assigning attributes into several tables to reduce data redudancy and help eliminate/remove data anomalies. </li></ul><ul><li>Purpose – </li></ul><ul><li>(i) To eliminate redundant data and data anomalies </li></ul><ul><li>(ii) To ensure the correctness in data dependencies </li></ul>
20. 24. NORMALIZATION <ul><li>Unnormalized Form (UNF) – table contains one or more repeating group. </li></ul><ul><li>EX 1: Relation Schema? NF? </li></ul>
22. 26. NORMALIZATION <ul><li>EX 2: UNORMALIZAED FORM (UNF ) </li></ul>
23. 27. NORMALIZED FORM (NF) Relational Schema: CUSTOMER ( Cust_No , Cust_Name, Address) Table 6‑25 The CUSTOMER Table (NF) Relational Schema: INVOICE ( Cust_No , Item_Code , Qty) Table 6‑26 The INVOICE Table (NF) Relational Schema: ITEM ( Item_Code , Item_desc, Price, Supplier) Table 6‑27 The ITEM Table (NF) Relational Schema: SUPPLIER ( Supplier , Supplier_address) Table 6‑28 The SUPPLIER Table (NF) Ampang Rani A102 Ampang Salmah A101 Sentul Abu A100 Address Cust_Name Cust_No 4 2 2 MS112 CP200 VG400 A102 A102 A102 10 10 5 HD200 KB100 SP360 A101 A101 A101 10 10 5 HD200 KB100 SP360 A101 A101 A101 20 10 2 KB100 CP200 MS112 A100 A100 A100 Qty Item_Code Cust_No XYZ Ent. 200 VGA Card VG400 XYZ Ent. 650 CPU CP200 XYZ Ent. 45 Speaker SP360 XYZ Ent. 15 Mouse MS112 Seagate 100 Hard Disc HD200 XYZ Ent. 25 Keyboard KB100 Supplier Price Item_desc Item_Code Pulau Pinang Seagate Petaling Jaya XYZ Ent. Supplier_address Supplier
24. 28. LEVEL OF NORMALIZATION No repeating groups of data in the table No partial functional dependancy No transitive dependancy
25. 29. LEVEL OF NORMALIZATION <ul><li>First Normal Form (1NF) </li></ul><ul><li>Data stored in a table that does not have any repeating groups. </li></ul><ul><li>Second Normal Form (2NF) </li></ul><ul><li>It is a relation that is in 1NF with every non primary key attribute fully functionally dependent on one primary key. </li></ul><ul><li>The tables at this Normal Form do not have any partial functional dependency , if every non-primary key attributes are fully dependent on one primary key . </li></ul><ul><li>Third Normal Form (3NF) </li></ul><ul><li>It is a relation that has removed transitive dependency . </li></ul><ul><li>A transitive dependency exists when you have the following functional dependency pattern for the relation: A->B, B->C therefore A->C. For a removed transitive dependency, it means that A should relate directly to B and to C, i.e. A->B and A->C. </li></ul>
26. 30. STEPS IN NORMALIZATION <ul><li>Identify repeating group in UNF table. </li></ul><ul><li>Create separate table for repeating group. </li></ul><ul><li>Identify Functional Dependant relationship using technique what attributes depend on which Primary Key (PK). </li></ul><ul><li><PRIMARY KEY> <DEPENDANT </li></ul><ul><li> ATTRIBUTE> </li></ul><ul><li>Identify Transitive Dependency. A condition in which attributes are dependant on another attribute that is not a primary key. </li></ul><ul><li>Remove the Transitive Dependancies </li></ul>
27. 31. FUNCTIONAL DEPENDENCIES(FD) <ul><li>Definition: A functional dependency occurs when one attribute in a relation uniquely determines another attribute. This can be written (A -> B) means &quot;B is functionally dependent on A.“ </li></ul>StudentName can be uniquely determined from StudentID. The reverse statement is not true because more than one student can have the same name but different StudentID. (StudentName->StudentID) STUDENT( StudentID ,StudentName ) StudentName is functionally dependant on StudentID or (StudentID->StudentName). WHY?
28. 32. TRANSITIVE DEPENDENCIES <ul><li>Definition : A transitive dependency exists when you have the following functional dependency pattern for the relation: A->B, B->C therefore A->C. For a removed transitive dependency, it means that A should relate directly to B and to C, i.e. A->B and A->C. </li></ul><ul><li>Relation (Emp, Dept, Division) </li></ul><ul><li>Employee is assigned to one dept and each dept is assigned to one division. </li></ul><ul><li>FD Emp->Dept, Dept->Division </li></ul><ul><li>:. Emp->Division is Transitive. </li></ul>
29. 33. NORMALIZATION <ul><li>1 STEP : REMOVE REPEATING GROUP </li></ul>Repetitive group : Attributes that contains more than one value in each and every line. Sahada Rahman Associate Diploma in Interactive Multimedia Shah Alam C A A 4 4 4 ART410 ART 210 BUS210 Promotion Design Graphic Design Application Business Organisation Mazlina Yakub S0151 Ahmad Razak Diploma in Computer Graphic Design Shah Alam A B B 4 2 4 ART310 ART230 BUS210 Graphic Communication Introduction to graphic Design Business Organization Amirul Hamdan S0144 Fazilah Musa Diploma in Information Technology Sentul A B C 4 4 4 ACT410 ADM101 ART210 Computerised Accounting Internet Publishing Graphic Design Application Azlina Ahmad S0001 Coord inator Course Add. Grade Credit Hours Subject Code Subject Name Student Name Student ID