• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
D I T211    Chapter 6
 

D I T211 Chapter 6

on

  • 2,908 views

 

Statistics

Views

Total Views
2,908
Views on SlideShare
2,901
Embed Views
7

Actions

Likes
1
Downloads
0
Comments
1

1 Embed 7

http://www.slideshare.net 7

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • 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
    Your message goes here
    Processing…
Post Comment
Edit your comment

    D I T211    Chapter 6 D I T211 Chapter 6 Presentation Transcript

    • CHAPTER 6 NORMALIZATION
    • NORMALIZATION
      • 6.1 RELATIONAL DATA MODEL
      • 6.1.1 What is relation?
      • 6.1.2 A Notation of Relation
      • 6.1.3 Problems in Relational Data Model
      • 6.2 Normalization
        • 6.2.1 Definition of Normalization
        • 6.2.2 Purpose of Normalization
        • 6.2.3 Level of Normalization
        • 6.2.4 Steps in Normalization
    • OBJECTIVE
      • Define relation and discuss its notation and relational schema.
      • Recognize problems in designing relational data model.
      • Define normalization and the relative level of normalization.
      • Identify the steps in normalization.
      • To normalize an un-normalized data model
    • RELATIONAL DATA MODEL
      • Relation – A two dimensional table with columns and rows.
      Table 6.1: Relational Table
    • NOTATION OF RELATION
      • Relation Schema- list of attributes and their corresponding domains.
      • Format:
      Relation_Name (Primary_key, Non_Key_Attribute)
    • Relation Schema?
    •  
    • 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
    • PROBLEM in RELATIONAL DATA MODEL
      • There are 2 problem:
      • 1. Anomalies
      • 2. Information Redundancy
    • ANOMALIES
      • Errors or inconsistencies when user update a table that contains redundant data.
      • 3 types of anomalies:
      • (i) Modification Anomalies
      • (ii) Insert Anomalies
      • (iii) Delete Anomalies
    • 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
    • MODIFICATION ANOMALIES
      • Problem?
      • Changing the data of a record may causing changing the data of a few records.
      • Solution?
      • Separate STUDENT_COURSE table into TWO tables.
    •  
    • INSERT ANOMALIES
    • INSERT ANOMALIES
      • Problem?
      • Confusing error in adding new record with null primary key may happen.
      • Solution?
      • Separate STUDENT_COURSE table into TWO tables.
    •  
    • DELETE ANOMALIES
    • DELETE ANOMALIES
      • Problem?
      • Deletion of one record can cause the table provide insufficient information.
      • Solution?
      • Separate STUDENT_COURSE table into TWO tables.
    •  
    • INFORMATION REDUNDANCIES
      • Duplication because of storing the same data multiple times.
      • Problem?
      • 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.
      • Solution?
      • Separate the STUDENT_SUBJECT table into THREE Tables.
      INFORMATION REDUNDANCIES
    • 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
    • NORMALIZATION
      • Definition - Process for assigning attributes into several tables to reduce data redudancy and help eliminate/remove data anomalies.
      • Purpose –
      • (i) To eliminate redundant data and data anomalies
      • (ii) To ensure the correctness in data dependencies
    • NORMALIZATION
      • Unnormalized Form (UNF) – table contains one or more repeating group.
      • EX 1: Relation Schema? NF?
    • Relational Schema: STUDENT ( Stud_ID , Stud_Name, Address, Course_Code) Table 6‑20 The STUDENT Table (NF) Relational Schema: SUBJECT ( Subject_Code , Subject_Name, Credit_Hours) Table 6‑21 The SUBJECT Table (NF) Relational Schema: STUDENT_GRADE ( Student_ID , Subject_Code , Grade) Table 6‑22 The STUDENT_GRADE Table (NF) Relational Schema: COURSE ( Course_Code , Course_Name,Coordinator) Table 6‑23 The COURSE Table (NF) ADIM Shah Alam Maslina Yakub S0151 DCGD Shah Alam Amirul Hamdan S0144 DIT Sentul Azlina Ahmad S0001 Course_Code Address Stud_Name Stud_ID 4 Graphic Design Application ART210 4 Internet Publishing QDM101 4 Business Organization BUS210 2 Introduction to graphic Design ART230 4 Promotion Design ART410 4 Graphic Communication ART310 4 Computerized Accounting, ACT410 Credit_Hours Subject_Name Subject_Code A BUS210 S0151 A ART 210 S0151 C ART410 S0151 B BUS210 S0144 B ART230 S0144 A ART310 S0144 C ART210 S0001 B ADM101 S0001 A ACT410 S0001 Grade Subject_Code Student_ID Sahada Associate Diploma in Interactive Multimedia ADIM Ahmad Diploma in Computer Graphic Design DCGD Fazilah Diploma in Information Technology DIT Coordinator Course_Name Course_Code
    • NORMALIZATION
      • EX 2: UNORMALIZAED FORM (UNF )
    • 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
    • LEVEL OF NORMALIZATION No repeating groups of data in the table No partial functional dependancy No transitive dependancy
    • LEVEL OF NORMALIZATION
      • First Normal Form (1NF)
      • Data stored in a table that does not have any repeating groups.
      • Second Normal Form (2NF)
      • It is a relation that is in 1NF with every non primary key attribute fully functionally dependent on one primary key.
      • 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 .
      • Third Normal Form (3NF)
      • It is a relation that has removed transitive dependency .
      • 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.
    • STEPS IN NORMALIZATION
      • Identify repeating group in UNF table.
      • Create separate table for repeating group.
      • Identify Functional Dependant relationship using technique what attributes depend on which Primary Key (PK).
      • <PRIMARY KEY> <DEPENDANT
      • ATTRIBUTE>
      • Identify Transitive Dependency. A condition in which attributes are dependant on another attribute that is not a primary key.
      • Remove the Transitive Dependancies
    • FUNCTIONAL DEPENDENCIES(FD)
      • 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.“
      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?
    • TRANSITIVE DEPENDENCIES
      • 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.
      • Relation (Emp, Dept, Division)
      • Employee is assigned to one dept and each dept is assigned to one division.
      • FD Emp->Dept, Dept->Division
      • :. Emp->Division is Transitive.
    • NORMALIZATION
      • 1 STEP : REMOVE REPEATING GROUP
      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
    • Relational Schema: STUDENT ( Student_ID , Student_Name , Subject_Code, Grade, Address, Course, Coordinator) Relational Schema: SUBJECT ( Subject_Code , Subject_Name, Credit_Hour) STUDENT SUBJECT Sahada Rahman Associate Diploma in Interactive Multimedia Shah Alam A BUS210 Mazlina Yakub S0151 Sahada Rahman Associate Diploma in Interactive Multimedia Shah Alam A ART 210 Mazlina Yakub S0151 Sahada Rahman Associate Diploma in Interactive Multimedia Shah Alam C ART410 Mazlina Yakub S0151 Ahmad Razak Diploma in Computer Graphic Design Shah Alam B BUS210 Amirul Hamdan S0144 Ahmad Razak Diploma in Computer Graphic Design Shah Alam B ART230 Amirul Hamdan S0144 Ahmad Razak Diploma in Computer Graphic Design Shah Alam A ART310 Amirul Hamdan S0144 Fazilah Musa Diploma in Information Technology Sentul C ART210 Azlina Ahmad S0001 Fazilah Musa Diploma in Information Technology Sentul B ADM101 Azlina Ahmad S0001 Fazilah Musa Diploma in Information Technology Sentul A ACT410 Azlina Ahmad S0001 Coordinator Course Address Grade Subject_Code Student_Name Student ID 4 Promotion Design ART410 4 Business Organization. BUS210 2 Introduction to graphic Design ART230 4 Graphic Communication ART310 4 Graphic Design Application ART210 4 Internet Publishing QDM101 4 Computerised Accounting ACT410 Credit_Hour Subject_Name Subject_Code
    • NORMALIZATION
      • 2 STEP : Remove Partial Functional Dependencies
        • Identify all possible Functional Dependencies.
        • Create tables for the above dependencies.
      Grade Student_ID, Subject_Code Subject_Name, Credit_Hours Subject_Code Student_Name, Address, Course, Coordinator Student_ID
    • Relational Schema: STUDENT ( Student_ID , Student_Name, Address, Course, Coordinator) Relational Schema: SUBJECT( Subject_Code , Subject_Name, Credit_Hours) Table 6‑33 The SUBJECT Table (2NF) Relational Schema: STUDENT_GRADE ( Student_ID , Subject_Code , Grade) Table 6‑34 The STUDENT_GRADE Table (2NF) Sahada Associate Diploma in Interactive Multimedia Shah Alam Mazlina Yakub S0151 Ahmad Diploma in Computer Graphic Design Shah Alam Amirul Hamdan S0144 Fazilah Diploma in Information Technology Sentul Azlina Ahmad S0001 Coordinator Course Address Student_Name Student_ID 4 Promotion Design ART410 4 Business Organization. BUS210 2 Introduction to graphic Design ART230 4 Graphic Communication ART310 4 graphic Design Application ART210 4 Internet Publishing QDM101 4 Computerised Accounting ACT410 Credit_Hours Subject_Name Subject_Code A BUS210 S0151 A ART210 S0151 C ART410 S0151 B BUS210 S0144 B ART230 S0144 A ART310 S0144 C ART210 S0001 B QDM101 S0001 A ACT410 S0001 Grade Subject_Code Student_ID
    • NORMALIZATION
      • STEP 3 : Remove Transitive Dependencies
      • Identify all possible Transitive Dependencies:
      Subject_Name, Credit_Hours Subject_Code Grade Student_ID, Subject_Code Student_Name, Address, Course, Coordinator Student_ID
    • NORMALIZATION
      • Remove all transitive dependencies as follows:
      The 4 functional dependencies (with Transitive Dependencies removed) are: There are ready to be created as 3NF’s tables. Coordinator Course Subject_Name, Credit_Hours Subject_Code Grade Student_ID, Subject_Code Student_name, Address, Course Student_ID
    • Relational Schema: STUDENT (Student_ID, Student_Name, Address,Course) Table 6‑35 The STDENT Table (3NF) Relational Schema: SUBJECT( Subject_Code , Subject_Name, Credit_Hours) Table 6‑36 The SUBJECT Table (3NF) Relational Schema: COURSE ( Course , Coordinator) Table 6‑37 The COURSE Table (3NF) Relational Schema: STUDENT_GRADE ( Student_ID , Subject_Code , Grade) Table 6‑38 The STUDENT_GRADE Table (3NF) Associate Diploma in Interactive Multimedia Shah Alam Mazlina Yakub S0151 Diploma in Computer Graphic Design Shah Alam Amirul Hamdan S0144 Diploma in Information Technology Sentul Azlina Ahmad S0001 Course Address Student_Name Student_ID 4 Graphic Design Application ART210 4 Internet Publishing QDM101 4 Business Organization BUS210 2 Introduction to graphic Design ART230 4 Promotion Design ART410 4 Graphic Communication ART310 4 Computerised Accounting, ACT410 Credit_Hours Subject_Name Subject_Code Sahada Associate Diploma in Interactive Multimedia Ahmad Diploma in Computer Graphic Design Fazilah Diploma in Information Technology Coordinator Course A BUS210 S0151 A ART 210 S0151 C ART410 S0151 B BUS210 S0144 B ART230 S0144 A ART310 S0144 C ART210 S0001 B ADM101 S0001 A ACT410 S0001 Grade Subject_Code Student_ID
    • EXAMPLES FD
      • Definition: A functional dependency occurs when one attribute in a relation uniquely determines another attribute. This can be written A -> B which would be the same as stating &quot;B is functionally dependent upon A.&quot;
      • Examples: In a table listing employee characteristics including Social Security Number (SSN) and name, it can be said that name is functionally dependent upon SSN (or SSN -> name) because an employee's name can be uniquely determined from their SSN. However, the reverse statement (name -> SSN) is not true because more than one employee can have the same name but different SSNs.