Vous êtes sur la page 1sur 64

PENORMALAN

NORMALISATION
NORMALISATION
F4109: DATABASE SYSTEM

Objektif

Pada akhir bab ini, pelajar akan dapat:

Mentakrif Relation
Mengenal pasti masalah dalam relational data model.
Mentakrif penormalan dan tahap penormalan.
Mengenal pasti langkah-langkah penormalan.

Objective

At the end of this chapter, students should be able to :

Define relation.
Recognize problems in relational data model.
Define normalization and the level of normalization.
Identify the step in normalization.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

3.1 Model Relational Data

3.1.1 Apa itu Relation

RELATION adalah satu jadual 2 dimensi yang mempunyai lajur dan baris.

3.1 Relational Data Model

3.1.1 What is a Relation

A two-dimensional table with columns and rows is called a RELATION.

Contoh / Example :

Lajur (Column / Attribute)

PUBLISHER
Publisher_Code Name City
F-B1 Fajar Bakti Malaysia Baris
(Row / Tuple)
M-G1 McGraw Hill UK
P-H1 Prentice Hall UK
T-H1 Thompson Learning US

Notasi Relation / A notation of Relation

PUBLISHER Nama Relation / Relation Name

Publisher_Code Name City


F-B1 Fajar Bakti Malaysia
M-G1 McGraw Hill UK
P-H1 Prentice Hall UK
T-H1 Thompson US
Learning

Kunci Primer / Primary Key Atribut Bukan Kunci / Non-primary key (Non key attribute)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Skema Hubungan / Relation Schema

Skema hubungan adalah senarai atribut yang terkandung dalam hubungan tersebut. / A
relation scheme is a list of attributes and their corresponding domains.

Format : Nama_relation (Kunci Primer, Atribut Bukan Kunci)

Format: Relation_name (Primary_key, Non_ Key_Attribute)

Daripada contoh di atas, anda boleh mengenal pasti / From the example, we can identify:

1) Nama relation / Relation name : PUBLISHER


2) Kunci Primer / Primary Key : Publisher_Code
3) Atribut Bukan Kunci / Non Primary Key : Name, City

Oleh itu skema hubungan ialah / The relation schema will be like this:

PUBLISHER (Publisher_Code, Name, City)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh / Example : Berikut adalah contoh table bagi pangkalan data E-Book / Below are the example of
table in E-Book database.
PUBLISHER
Publisher_Code Name City
F-B1 Fajar Bakti Malaysia
M-G1 McGraw Hill UK
P-H1 Prentice Hall UK
T-H1 Thompson Learning US

AUTHOR BOOK_AUTHOR
Author_No Author_Name Book_Code Author_No
A001 Ruth Maran P01 A006
A002 McFadden P02 A001
A003 Kaufeld John P03 A002
A004 Curtis Frye P04 A003
A005 Joe Adamski P05 A004
A006 Kroenke P06 A008
A007 Pratt Philip J. P07 A005
A008 Mardiana, Hasnah
A009 Harrington, T
A010 Connolly, T

BOOK
Book
Book_Title Publisher_Code Description Type Price Book_Sample Book_Cover
Code
P01 Access 2000 Processing M-G1 Database 76.00 Yes

P02 Teach Yourself Microsoft M-G1 Database 80.00 No


Access 2000 Visually
P03 Concepts of Database P-H1 Database 100.00 No
Management System
P04 Microsoft Access 2000 T-H1 Database 59.00 No
Complete
P05 Database Processing T-H1 Database 69.00 No

P06 Pengajian Malaysia F-B1 Pengetahuan 40.00 No


Am
P07 Adobe Illustrator 10 M-G1 Multimedia 88.00 No

P08 Graphic Design M-G1 Graphic 80.00 No

Skema hubungan adalah seperti berikut / The relation schema are :


PUBLISHER (Publisher_Code, Name, City)
AUTHOR (Author_No, Author_Name)
BOOK_AUTHOR (Book_Code, Author_No)
BOOK(Book_Code, Book_Title, , Description, Type, Price, Book_Sample, Book_Cover, Publisher_Code)

** Dalam skema hubungan, atribut kunci asing akan ditandakan dengan garis . / In relation schema, foreign
key attribute will be mark with this line .

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

3.1.2 Masalah Di Dalam Model Relational Data

Terdapat 2 masalah dalam model relational data, iaitu :


- Anomali
- Pertindanan Maklumat

(a) Anomali Pengemaskinian (Update Anomalies)


Anomali - Ralat yang mungkin berlaku apabila pengguna ingin mengemas kini jadual
(relation / table) yang mengandungi data yang berulang.

Jenis-jenis Anomali:
(i) Anomali Pengubahsuaian
(ii) Anomali penambahan
(iii) Anomali penghapusan

(b) Pertindanan Maklumat (Information Redundancy)


Maklumat yang berulang yang disebabkan oleh penyimpanan data yang sama
beberapa kali.

3.1.3 Problems In Relational Data Model

There are 2 problems in relational data model :


- Anomalies
- Information Redundancy

(a) Anomalies
Anomalies - Errors or inconsistencies that may result when a user attempts to update
a table that contains redundant data.

Types of anomalies:
(i) Modification Anomalies
(ii) Insert Anomalies
(iii) Delete Anomalies

(b) Information Redundancy


Duplication of data due to storing the same data multiple times.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

a) Anomali Pengemaskinian

i) Anomali Pengubahsuaian (Modification Anomalies)

PELAJAR_KURSUS
No_Pelajar Nama_pelajar Alamat Kod_kursus Nama_kursus

S0144 Hamizah Mohamed Jln. Kg. Gajah ASDIM Associate Diploma in


Redzwan Interactive Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru CGMP200 Computer Power
Bangi 200 (Graphic and
Multimedia)
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi CITP100 Computer power 100
Polis (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati CGMP200 Computer Power
200 (Graphic and
Multimedia)
S0035 Syed Ahmad Rizal B. Jalan Puchong DIPCGR Diploma in Computer
Syed Abdul Razak Graphic and Design.

Masalah :
Sekiranya pengguna ingin menukar Nama_kursus Computer Power 200 (Graphic and Multimedia)
kepada Computer Power 200 (Graphic) daripada jadual PELAJAR_KURSUS, maka, perubahan perlu di
lakukan pada setiap baris yang mempunyai Nama Kursus Computer Power 200 (Graphic and
Multimedia) . Masalah yang dihadapi ialah pengguna perlu membuat perubahan lebih daripada sekali.

a) Update Anomalies

i) Modification Anomalies

STUDENT_COURSE
Student_ID Student_Name Address Course_Code Course_Name

S0144 Hamizah Mohamed Jln. Kg. Gajah ASDIM Associate Diploma in


Redzwan Interactive
Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru CGMP200 Computer Power 200
Bangi (Graphic and
Multimedia)
S0157 Nurazean Bt. Md. Tmn. Koperasi CITP100 Computer power 100
Sobri Polis (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati CGMP200 Computer Power 200
(Graphic and
Multimedia)
S0035 Syed Ahmad Rizal B. Jalan Puchong DIPCGR Diploma in Computer
Syed Abdul Razak Graphic and Design.

The Problem :
If we want to update Course_Name Computer Power 200 (Graphic & Multimedia) to Computer Power
200 (Graphic) from STUDENT_COURSE table, we have to update all the rows of all students who take
that course. The problem is we have to update more than once.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Penyelesaian :

Bagi menyelesaikan masalah ini, pengguna harus mengasingkan relation PELAJAR_KURSUS seperti
berikut:

PELAJAR
No_pelajar Nama_pelajar Alamat Kod_kursus

S0144 Hamizah Mohamed Redzwan Jln. Kg. Gajah ASDIM


S0149 Amjadi Abd. Mubin Bandar Baru Bangi CGMP200
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi Polis CITP100
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati CGMP200
S0035 Syed Ahmad Rizal B. Syed Jalan Puchong DIPCGR
Abdul Razak

KURSUS
Kod_kursus Nama_kursus

ASDIM Associate Diploma in Interactive Multimedia


CGMP200 Computer Power 200 (Graphic )
CITP100 Computer power 100 (IT)
DIPCGR Diploma in Computer Graphic and Design

Proses pengubahsuaian akan berlaku sekali sahaja tanpa melibatkan rekod yang lain.

The Solution :

Therefore, to avoid this problem, we have to separate the STUDENT_COURSE table as follows :

STUDENT
Student_ID Student_Name Address Course_Code

S0144 Hamizah Mohamed Redzwan Jln. Kg. Gajah ASDIM


S0149 Amjadi Abd. Mubin Bandar Baru Bangi CGMP200
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi Polis CITP100
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati CGMP200
S0035 Syed Ahmad Rizal B. Syed Jalan Puchong DIPCGR
Abdul Razak

COURSE
Course_Code Course_Name
ASDIM Associate Diploma in Interactive Multimedia
CGMP200 Computer Power 200 (Graphic )
CITP100 Computer power 100 (IT)
DIPCGR Diploma in Computer Graphic and Design

The process to update Course will occur once without affecting other records.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

ii) Anomali Penambahan

PELAJAR_KURSUS
No_Pelajar Nama_pelajar Alamat Kod_kursus Nama_kursus

S0144 Hamizah Mohamed Jln. Kg. Gajah ASDIM Associate Diploma in


Redzwan Interactive Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru CGMP200 Computer Power 200
Bangi (Grafik dan
Multimedia)
S0157 Nurazean Bt. Md. Tmn. Koperasi CITP100 Computer power 100
Sobri Polis (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati DIPCGR Diploma in Computer
Graphic and Design
S0035 Syed Ahmad Rizal B. Jalan Puchong CGMP200 Computer Power 200
Syed Abdul Razak (Grafik dan
Multimedia)
(null) (null) (null) (null) Diploma in
Information
Technology

Masalah :

Sekiranya pengguna ingin menambah Kod_kursus dan Nama_kursus yang baru ke dalam jadual
PELAJAR_KURSUS, field No_pelajar, Nama_pelajar, alamat akan mempunyai nilai null (tiada data).
Masalah yang dihadapi ialah Kunci Primer (No_pelajar) tidak boleh mempunyai nilai null.

ii) Insert Anomalies

STUDENT_COURSE
Student_ID Student_name Address Course_Code Course_Name

S0144 Hamizah Mohamed Jln. Kg. Gajah ASDIM Associate Diploma in


Redzwan Interactive
Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru CGMP200 Computer Power 200
Bangi (Graphic and
Multimedia)
S0157 Nurazean Bt. Md. Tmn. Koperasi CITP100 Computer power 100
Sobri Polis (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati DIPCGR Diploma in Computer
Graphic and Design
S0035 Syed Ahmad Rizal B. Jalan Puchong CGMP200 Computer Power 200
Syed Abdul Razak (Graphic and
Multimedia)
(null) (null) (null) (null) Diploma in
Information
Technology

The Problem :

If we want to insert a new Course_Code and Course_Name to the STUDENT_COURSE table, it is


necessary to enter no data (null) into the attribute for student (Student_ID, Student_Name, Address).
The problem is the primary key (Student_ID) cannot be null.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Penyelesaian:

Bagi menyelesaikan masalah ini, pengguna harus mengasingkan jadual PELAJAR_KURSUS seperti
berikut:

PELAJAR

No_pelajar Nama_pelajar Alamat Kod_kursus

S0144 Hamizah Mohamed Redzwan Jln. Kg. Gajah ASDIM


S0149 Amjadi Abd. Mubin Bandar Baru Bangi CGMP200
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi Polis CITP100
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati CGMP200
S0035 Syed Ahmad Rizal B. Syed Jalan Puchong DIPCGR
Abdul Razak

KURSUS

Kod_kursus Nama_kursus
ASDIM Associate Diploma in Interactive Multimedia
CGMP200 Computer Power 200 (Grafik)
CITP100 Computer power 100 (IT)
DIPCGR Diploma in Computer Graphic and Design
CGMP200 Diploma in Information Technology

Mana-mana penambahan tidak akan mempengaruhi Kunci Primer (primary key) dalam relation
PELAJAR.

The Solution :

Therefore, to avoid this problem, we have to separate the STUDENT_COURSE table as follows :

STUDENT
Student_ID Student_Name Address Course_Cide
S0144 Hamizah Mohamed Redzwan Jln. Kg. Gajah ASDIM
S0149 Amjadi Abd. Mubin Bandar Baru Bangi CGMP200
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi Polis CITP100
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati CGMP200
S0035 Syed Ahmad Rizal B. Syed Jalan Puchong DIPCGR
Abdul Razak

COURSE

Course_Code Course_Name
ASDIM Associate Diploma in Interactive Multimedia
CGMP200 Computer Power 200 (Graphic)
CITP100 Computer power 100 (IT)
DIPCGR Diploma in Computer Graphic and Design
CGMP200 Diploma in Information Technology

Any insertion to the COURSE table will not affect to the primary key in STUDENT table.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

iii) Anomali Penghapusan

PELAJAR_KURSUS
No_Pelajar Nama_pelajar Alamat Kod_kursus Nama_kursus

S0144 Hamizah Mohamed Jln. Kg. Gajah ASDIM Associate Diploma


Redzwan in Interactive
Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru CGMP200 Computer Power
Bangi 200 (Grafik dan
Multimedia)
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi CITP100 Computer power
Polis 100 (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati DIPCGR Diploma in
Computer Graphic
and Design
S0035 Syed Ahmad Rizal B. Jalan Puchong CGMP200 Computer Power
Syed Abdul Razak 200 (Grafik dan
Multimedia)

Masalah :

Apabila maklumat pelajar Aidil Akmar Hj. Ayob dihapuskan daripada relation PELAJAR_KURSUS,
secara tidak langsung, maklumat mengenai Kursus DIPCGR (Diploma in Computer Graphic and
Design) juga akan terhapus. Ini bermakna tidak ada lagi kursus DIPCGR di dalam pangkalan data.

iii) Delete Anomalies

STUDENT_COURSE
Student_ID Student_Name Address Course_Code Course_Name

S0144 Hamizah Mohamed Jln. Kg. Gajah ASDIM Associate Diploma


Redzwan in Interactive
Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru CGMP200 Computer Power
Bangi 200 (Graphic and
Multimedia)
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi CITP100 Computer power
Polis 100 (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati DIPCGR Diploma in
Computer Graphic
and Design
S0035 Syed Ahmad Rizal B. Jalan Puchong CGMP200 Computer Power
Syed Abdul Razak 200 (Graphic and
Multimedia)

The Problem :

When the Student_ID S0035 is deleted from STUDENT_COURSE table, information about any
Course_Code DIPCGR related to that student will also be deleted. That means no other Course_Code
DIPCGR remains in the database.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Penyelesaian:

Bagi menyelesaikan masalah ini, pengguna harus mengasingkan jadual PELAJAR_KURSUS seperti
berikut:

PELAJAR
No_Pelajar Nama_pelajar Alamat Kod_kursus

S0144 Hamizah Mohamed Redzwan Jln. Kg. Gajah ASDIM


S0149 Amjadi Abd. Mubin Bandar Baru Bangi CGMP200
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi Polis CITP100
S0035 Syed Ahmad Rizal B. Syed Jalan Puchong CGMP200
Abdul Razak

KURSUS
Kod_kursus Nama_kursus

ASDIM Associate Diploma in Interactive Multimedia


CGMP200 Computer Power 200 (Graphic)
CITP100 Computer power 100 (IT)
DIPCGR Diploma in Computer Graphic and Design
CGMP200 Diploma in Information Technology

Mana-mana penghapusan data daripada relation PELAJAR tidak akan melibatkan data dalam relation
KURSUS

The Solution :

Therefore, to avoid this problem, we have to separate the STUDENT_COURSE table as follows :

STUDENT
Student_ID Student_Name Address Course_Code

S0144 Hamizah Mohamed Redzwan Jln. Kg. Gajah ASDIM


S0149 Amjadi Abd. Mubin Bandar Baru Bangi CGMP200
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi Polis CITP100
S0035 Syed Ahmad Rizal B. Syed Jalan Puchong CGMP200
Abdul Razak

COURSE

Course_Code Course_Name

ASDIM Associate Diploma in Interactive Multimedia


CGMP200 Computer Power 200 (Grafik)
CITP100 Computer power 100 (IT)
DIPCGR Diploma in Computer Graphic and Design
CGMP200 Diploma in Information Technology

Any deletion from STUDENT table will not affect the data in COURSE table.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

(b) Pertindanan Maklumat (Information Redundancy)


- Data yang sama disimpan berulang kali

PELAJAR_SUBJEK
NoPelajar Nama_pelajar Alamat Kod Subjek Nama Subjek Jam Kredit

S0144 Hamizah Mohamed Jln. Kg. Gajah ACT410 Computerised 4


Redzwan Accounting
S0149 Amjadi Abd. Mubin Bandar Baru Bangi ADM101 Internet 4
Publishing
S0157 Nurazean Bt. Md. Tmn. Koperasi Polis ADM101 Internet 4
Sobri Publishing
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati ADM301 Project 4
S0035 Syed Ahmad Rizal B. Jalan Puchong ADM101 Internet 4
Syed Abdul Razak Publishing

Masalah :

Di dalam jadual PELAJAR_SUBJEK terdapat maklumat yang bertindan. Jadual di atas menunjukkan
data mengenai Subjek di simpan berulang kali. Akibatnya, ia merugikan ruang storan.

(b) Information Redundancy


- Duplication of data due to the storing of the same data multiple times.

STUDENT_SUBJECT
Student_ID Student_Name Address Subject_Code Subject_Name Credit_Hours
S0144 Hamizah Mohamed Jln. Kg. Gajah ACT410 Computerised 4
Redzwan Accounting
S0149 Amjadi Abd. Mubin Bandar Baru ADM101 Internet 4
Bangi Publishing
S0157 Nurazean Bt. Md. Tmn. Koperasi ADM101 Internet 4
Sobri Polis Publishing
S0159 Aidil Akmar Hj. Tmn. Melawati ADM301 Project 4
Ayob
S0035 Syed Ahmad Rizal Jalan Puchong ADM101 Internet 4
B. Syed Abdul Publishing
Razak

The 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.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Penyelesaian :

Bagi menyelesaikan masalah di atas, pengguna haruslah mengasingkan relation PELAJAR_SUBJEK


seperti berikut:

Maklumat bagi setiap subjek dipaparkan sekali sahaja dalam


SUBJECT relation dan hanya data mengenai Subject_Code
diulang dalam STUDENT_SUBJECT relation.

The solution :

Therefore, to avoid this problem, we have to separate the STUDENT_SUBJECT table as follows :

It shows that the subject information appears only once for each
subject in SUBJECT relation & only the Subject_Code is
repeated in the STUDENT_SUBJECT relation.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

3.2 Penormalan (Normalisation)

Penormalan (Normalisation)
Satu proses untuk menempatkan atribut ke dalam jadual bagi mengelakkan masalah anomali dan
pertindanan data yang akan menyebabkan pangkalan data yang tidak stabil (Unnormalised).

Jadual Unnormalised (Unnormalised Form (UNF))


Jadual yang mengandungi satu atau lebih kumpulan data yang berulang.

3.2 Normalisation

Normalisation
A process for assigning attributes into table and reduces data redundancy and helps eliminate the data
anomalies that associated with poor database design (unnormalised).

Unnormalised Form (UNF)


A table that contains 1 or more repeating group.

Tujuan Penormalan:
Bagi memastikan pengemaskinian anomali (penambahan, penghapusan, pengubahsuaian)
tidak berlaku.
Untuk mengurangkan pengulangan data atau storan.
Memudahkan proses pencarian rekod.

The purpose of Normalisation :


To ensure that the updated anomalies (Insert, Delete, Modify) doesn’t occur.

To reduce data or storage redundancy.

To ensure record finding easy.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 1 / Example 1:
Jadual di bawah menunjukkan medan Subject_name, Subject_code, Credit_hour, dan Grade mengandungi nilai
berulang.

The table below shows that Subject_name, Subject_code, Credit_hour and Grade fields which contains multiple or
more repeating values.

Jadual Unnormalised / Unnormalised Form (UNF)

STUDENT
Stud_ID Stud_ Subject_Name Subject_Code Credit_ Grade Addr. Course Coor-
Name Hour dinator
S0001 Azlina Ahmad Computerised ACT410 4 A Sentul Dip. in Fazilah
Accounting Information
Internet Publishing ADM101 4 B Technology
Graphic Design ART210 4 C
Application
S0144 Amirul Hamdan Graphic ART310 4 A Shah Dip. in Ahmad
Communication Alam Computer
Introduction to ART230 2 B Graphic
Graphic Design Design
Business BUS210 4 B
Organization
S0151 Maslina Yakub Promotion Design ART410 4 C Shah Associate Sahada
Graphic Design ART 210 4 A Alam Dip. in
Application Interactive
Business BUS210 4 A Multimedia
Organisation

Data berulang / Repeating data

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 1 / Example 1:
Jadual yang telah dinormalkan (Normalised Form) / Normalised Form
STUDENT
Stud_ID Stud_Name Address Course
S0001 Azlina Ahmad Sentul Diploma in Information Technology
S0144 Amirul Hamdan Shah Alam Diploma in Computer Graphic Design
S0151 Maslina Yakub Shah Alam Associate Diploma in Interactive Multimedia
STUDENT (Stud_ID, Stud_Name, Address, Course)

SUBJECT
Subject_Code Subject_Name Credit_Hours
ACT410 Computerised Accounting, 4
ART310 Graphic Communication 4
ART410 Promotion Design 4
ART230 Introduction to graphic Design 2
BUS210 Business Organization 4
QDM101 Internet Publishing 4
ART210 Graphic Design Application 4
SUBJECT (Subject_Code, Subject_Name, Credit_hour_)

STUDENT_GRADE
Student_ID Subject_Code Grade
S0001 ACT410 A
S0001 ADM101 B
S0001 ART210 C
S0144 ART310 A
S0144 ART230 B
S0144 BUS210 B
S0151 ART410 C
S0151 ART 210 A
S0151 BUS210 A
STUDENT_GRADE (Student_ID, Subject_Code, Grade)

COURSE
Course Coordinator
Diploma in Information Technology Fazilah
Diploma in Computer Graphic Design Ahmad
Associate Diploma in Interactive Multimedia Sahada
COURSE (Course, Coordinator)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 2 / Example 2:
Jadual di bawah menunjukkan medan Item_Code, Item_Desc, Qty, Price, Supplier dan Supplier_Address
mengandungi nilai berulang (Repeating groups).

The table below shows that Item_code, Item_desc, Qty, Price, Supplier & Supplier_address fields contain
multiple or more repeating values.

Jadual Unnormalised (UNF) / Unnormalised Form (UNF)

INVOICE
Cust_No Cust_Name Address Item_Code Item_desc Qty Price Supplier Supp_
Address
A100 Abu Sentul KB100 Keyboard 20 25 XYZ Ent P. Jaya
CP200 CPU 10 650 XYZ Ent P. Jaya
MS112 Mouse 2 15 XYZ Ent. P. Jaya

A101 Salmah Ampang HD200 Hard Disc 10 100 Seagate P. Pinang


KB100 Keyboard 10 25 XYZ Ent P. Jaya
SP360 Speaker 5 45 XYZ Ent P. Jaya

102 Rani Ampang MS112 Mouse 4 15 XYZ Ent P. Jaya


CP200 CPU 2 650 XYZ Ent P. Jaya
VG400 VGA Card 2 200 XYZ Ent P. Jaya

Data berulang / Repeating data

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 2 / Example 2:
Jadual Normalised / Normalised Form
CUSTOMER
Cust_No Cust_Name Address

A100 Abu Sentul

A101 Salmah Ampang


A102 Rani Ampang
CUSTOMER (Cust_No, Cust_Name, Address)

INVOICE
Cust_No Item_Code Qty

A100 KB100 20
A100 CP200 10
A100 MS112 2

A101 HD200 10
A101 KB100 10
A101 SP360 5

A102 MS112 4
A102 CP200 2
A102 VG400 2
INVOICE (Cust_No, Item_Code, Qty)

ITEM
Item_Code Item_desc Price Supplier

KB100 Keyboard 25 XYZ Ent.

HD200 Hard Disc 100 Seagate

MS112 Mouse 15 XYZ Ent.


SP360 Speaker 45 XYZ Ent.
CP200 CPU 650 XYZ Ent.
VG400 VGA Card 200 XYZ Ent.
ITEM (Item_Code, Item_desc, Price, Supplier)

SUPPLIER
Supplier Supplier_address

XYZ Ent. Petaling Jaya

Seagate Pulau Pinang

SUPPLIER (Supplier, Supplier_address)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Tahap Penormalan / Level of Normalisation

Terdapat 3 tahap penormalan / There are 3 level of normalisation :

Bentuk Normal Pertama (First normal Form (1NF))

Bentuk Normal Kedua (Second Normal Form (2NF))

Bentuk Normal Ketiga (Third Normal Form (3NF))

Bentuk Normal Pertama (1NF)


Satu relation di mana setiap atributnya tidak mengandungi nilai yang berulang (satu nilai
sahaja).

 Bentuk Normal Kedua (2NF)


Satu relation di dalam 1NF dan setiap atribut bukan kunci primer adalah bersandar sepenuhnya
kepada kunci primer.

 Bentuk Normal Ketiga (3NF)


Satu relation yang berdasarkan kepada konsep kesandaran transitif.

First Normal Form (1NF)


A relation where the intersection of each row and column contains no repeating values (only
one value).

 Second Normal Form (2NF)


A relation that is in 1NF and every non-primary key attribute is fully functionally dependent on
the primary key.

 Third Normal Form (3NF)


A relation in which based on the concept of transitive dependency.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

3.2.1 Langkah-Langkah Penormalan

Jadual Dengan Kumpulan Data Yang


Jadual Dengan Kumpulan Data Yang
Berulang
Berulang Hapuskan kumpulan data yang
Unnormalised Form berulang
Unnormalised Form

Bentuk
BentukNormal
NormalPertama
Pertama(BN1)
(BN1)(First
(First Normal Form
Normal Form (1NF)) (1NF))
Kenal pasti Kesandaran
Fungsian
Bentuk Normal Kedua (BN2) (Second
Normal Form (2NF))
Hapuskan
Bentuk Normal Ketiga (BN3) kesandaran
Transitif
(Third Normal Form (3NF))

3.2.1 Steps in Normalisation

Table with repeating groups


(Unnormalised Form (UNF))
Remove repeating groups

First normal Form (1NF)

Identify Functional
Dependencies
Second Normal Form (2NF)

Remove Transitive
Third Normal Form (3NF) Dependencies

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 1:
Langkah-Langkah Penormalan

Jadual dengan kumpulan data yang


berulang (UNF) . Hapuskan kumpulan data yang
(rujuk jadual 1.1) berulang
(rujuk Nota 1.1)

Bentuk Normal Pertama (First


normal Form (1NF))
(rujuk jadual 1.2) Kenal pasti Kesandaran
Fungsian. (rujuk Nota 1.2)

Bentuk Normal Kedua


(Second Normal Form (2NF))
(rujuk jadual 1.3)
Hapuskan Kesandaran Transitif
(rujuk nota 1.3)

Bentuk Normal Ketiga


(Third Normal Form (3NF))
(rujuk jadual 1.4)

Example 1:
Steps in Normalisation

Table with repeating groups


(Unnormalised Form (UNF)) Remove repeating groups
(refer table 1.1) (refer Note 1.1)
(rujuk jadual 1.1)

First normal Form (1NF)


(refer table 1.2) Identify Functional
Dependencies
(refer Note 1.2)

(Second Normal Form (2NF))


(refer table 1.3)
Remove Transitive
Dependencies
(refer Note 1.3)
(Third Normal Form (3NF))
(refer table 1.4)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 1.1 / Table 1.1


Jadual Unnormalised (UNF) / Unnormalised Form (UNF)

Kumpulan data yang berulang / Repetitive group


Atribut yang mempunyai lebih daripada satu nilai di dalam setiap baris.
Attributes that contains more than one value in each and every line.

STUDENT
Student ID Student Subject Name Subject Credit Grade Address Course Coordinator
Name Code Hours
S0001 Azlina Computerised ACT410 4 A Sentul Diploma in Fazilah
Ahmad Accounting Information
Internet ADM101 4 B Technology
Publishing 4
Graphic Design ART210 C
Application
S0144 Amirul Graphic ART310 4 A Shah Alam Diploma in Ahmad
Hamdan Communication Computer
Introduction to ART230 2 B Graphic
graphic Design Design
Business BUS210 4 B
Organization

S0151 Mazlina Promotion ART410 4 C Shah Alam Associate Sahada


Yakub Design ART 210 4 Diploma in
Graphic Design A Interactive
Application BUS210 4 Multimedia
Business A
Organisation

STUDENT (Student_ID, Student_name, Subject_name , Subject_code, Credit_hour, Grade, Address, Course, Coordinator)

Terdapat banyak nilai di dalam satu baris di dalam lajur Nama_subjek, kod_subjek, jam_kredit dan gred.
The table above shows that Subject_name, Subject_code, Credit_hour and Grade fields which contains multiple
or more repeating values.

Nota 1.1: Note 1.1:


Masalah yang berlaku di dalam jadual yang mempunyai Problems that occur in tables with repeating groups :
kumpulan(nilai) berulang:
It’s hard to know exactly which Credit_Hour
Susah untuk mengetahui dengan tepat jam_kredit
belongs to which Subject_Name.
bagi sesuatu subjek .
To find a record in the table is very difficult.
Sukar untuk mencari rekod di dalam jadual.

Bagaimana Mengatasi masalah kumpulan Yang How to handle Repeating Groups?


Berulang? The repeating group can be handled by separating
Kumpulan yang berulang boleh diatasi dengan Unnormalised Form (UNF) into First Normal
menukarkan Unnormalised Form (UNF) kepada Form (1NF) as shown later.
First Normal Form (1NF). (Seperti jadual di bawah)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 1.2: / Table 1.2:


Bentuk Normal Pertama (INF) / First Normal Form (1NF)

STUDENT
Student ID Student Subject Grade Address Course Coordinator
Name code
S0001 Azlina Ahmad ACT410 A Sentul Diploma in Information Fazilah
Technology
S0001 Azlina Ahmad ADM101 B Sentul Diploma in Information Fazilah
Technology
S0001 Azlina Ahmad ART210 C Sentul Diploma in Information Fazilah
Technology
S0144 Amirul ART310 A Shah Alam Diploma in Computer Ahmad
Hamdan Graphic Design
S0144 Amirul ART230 B Shah Alam Diploma in Computer Ahmad
Hamdan Graphic Design
S0144 Amirul BUS210 B Shah Alam Diploma in Computer Ahmad
Hamdan Graphic Design
S0151 Mazlina ART410 C Shah Alam Associate Diploma in Sahada
Yakub Interactive Multimedia
S0151 Mazlina ART 210 A Shah Alam Associate Diploma in Sahada
Yakub Interactive Multimedia
S0151 Mazlina BUS210 A Shah Alam Associate Diploma in Sahada
Yakub Interactive Multimedia

STUDENT (Student_ID, Student_name, Subject_code, Grade, Address, Course, Coordinator)

SUBJECT
Subject_Code Subject_Name Credit_hour
ACT410 Computerised Accounting 4
QDM101 Internet Publishing 4
ART210 Graphic Design Application 4
ART310 Graphic Communication 4
ART230 Introduction to graphic Design 2
BUS210 Business Organization. 4
ART410 Promotion Design 4

SUBJECT (Subject_code, Subject_name, Credit_hour)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Nota 1.2 :
Kesandaran Fungsian
Kesandaran fungsian menjelaskan tentang perhubungan di antara atribut di dalam relation.

Kesandaran fungsian adalah hubungan di antara atribut di mana satu atau sekumpulan atribut boleh mengenal
pasti atribut lain dalam table yang sama.

Contoh:
Mikrokomputer di dalam makmal Komputer Cosmopoint mempunyai satu saiz ingatan komputer (MemorySize)
yang utama. Jadi, saiz ingatan komputer (MemorySize) adalah bergantung sepenuhnya kepada
Computerserialnumber.

Cara menulis:
Computerserialnumber MemorySize
Atribut di sebelah kiri dipanggil penentu (determinants).
Cara membaca:
“Computerserialnumber menentukan fungsian IngatanKomputer”
atau
“Computerserialnumber menentukan MemorySize”
atau
“MemorySize adalah bergantung sepenuhnya kepada Computerserialnumber”

Note 1.2 :
What is Functional Dependencies?
+ Functional Dependencies describe relationships between attributes in a relation.

A relationship between attributes in which one attribute or group of attribute determines the value of another in
the same table.

Example :
Consider microcomputers in a COSMOPOINT computer lab. Each has only one size of main memory. So
MemorySize is functionally dependent on ComputerSerialNumber.

How to write?
ComputerSerialNumber MemorySize

The attributes on the left side of the arrow are called determinants.
How to read?

“ComputerSerialNumber functionaly determines MemorySize”


or
“ComputerSerialNumber determines MemorySize”
or
“MemorySize is functionally dependent on ComputerSerialNumber”

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Nota 1.2 / Note 1.2 :

Mengenal pasti Kesandaran Fungsian / Identify Functional Dependencies

Student_ID Student_name Subject_code Grade Address Course Coordinator

Subject_code Subject_name Credit_hour

Student_ID Student_name, Address, Course, Coordinator


Subject_code Subject_name, Credit_hour
Student_ID, Subject_code Grade

Tiga kesandaran fungsian di atas ia akan membentuk tiga relations di dalam Bentuk Normal Kedua (2NF) .

Based on these 3 relations schema, there will be 3 tables (relations) in 2NF.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 1.3 / Table 1.3


Bentuk Normal Kedua (2NF) / Second Normal Form (2NF)

STUDENT
Student_ID Student_name Address Course Coordinator
S0001 Azlina Ahmad Sentul Diploma in Information Technology Fazilah
S0144 Amirul Hamdan Shah Diploma in Computer Graphic Design Ahmad
Alam
S0151 Mazlina Yakub Shah Associate Diploma in Interactive Sahada
Alam Multimedia
STUDENT (Student_ID, Student_name, Address, Course, Coordinator)

SUBJECT
Subject_code Subject_name Credit_hour
ACT410 Computerised Accounting 4
QDM101 Internet Publishing 4
ART210 graphic Design Application 4
ART310 Graphic Communication 4
ART230 Introduction to graphic Design 2
BUS210 Business Organization. 4
ART410 Promotion Design 4
Subject (Subject_code, Subject_name, Credit_hour)

STUDENT_GRADE
Student_ID Subject_code Grade
S0001 ACT410 A
S0001 QDM101 B
S0001 ART210 C
S0144 ART310 A
S0144 ART230 B
S0144 BUS210 B
S0151 ART410 C
S0151 ART210 A
S0151 BUS210 A
STUDENT_GRADE (Student_ID, Subject_code, Grade)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Nota 1.3:

Kesandaran Transitif (Transitive Dependencies)

Kesandaran fungsian di antara 2 atau lebih atribut bukan kunci (non key attribute). Satu keadaan di mana
atribut bergantung kepada atribut bukan kunci (non primary key) yang lain.
Satu hubungan berada dalam Bentuk Normal Ketiga (3NF) sekiranya hubungan itu berada dalam bentuk
normal kedua (2NF) dan tidak ada kesandaran transitif.
Atribut bukan kunci primer (non primary key) bergantung kepada atribut bukan kunci primer yang lain.

Note1.3:

What is Transitive Dependencies?

A functional dependency between 2 or more non-key attributes. A condition in which an attribute is


dependent on another attributes that is not part of the primary key.
A relation is in Third Normal Form (3NF) if it is in 2NF and has no transitive dependency.
Non-primary key attribute is functionally dependent on another non-primary key attribute.

Kesandaran Transitif / Transitive Dependencies

Student_ID Student_name Subject_code Grade Address Course Coordinator

Subject_code Subject_name Credit_hour

Student_ID Student_name, Address, Course, Coordinator


Student_ID, Subject_code Grade
Subject_code Subject_name, Credit_hour

Kesandaran Transitif / Transitive Dependencies

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Nota 1.3 / Note 1.3 :

Penyelesaian: untuk membangunkan Jadual Bentuk Normal ketiga (3NF), anda dikehendaki
menghapuskan kesandaran transitif.

Solution : In order to build 3NF table (relation), you have to remove the transitive dependencies.

Student_ID Student_name, Address, Course, Coordinator

Kesandaran transitif / Transitive Dependencies

Hasil / Becomes

Student_ID Student_name, Address, Course Akan membentuk 2 relations


Course Coordinator 2 tables (relation) are created

Oleh itu, terdapat 4 jadual dalam bentuk normal ketiga (3NF) seperti yang ditunjukkan di bawah:

So, there will be 4 tables in 3NF as shown below :

Student_ID Student_name, Address, Course


Student_ID, Subject_code Grade
Subject_code Subject_name, Credit_hour
Course Coordinator

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 1.4 / Table 1.4

Bentuk Normal Ketiga (3NF) / Third Normal Form (3NF)

STUDENT
Student_ID Student_name Address Course
S0001 Azlina Ahmad Sentul Diploma in Information Technology
S0144 Amirul Hamdan Shah Alam Diploma in Computer Graphic Design
S0151 Mazlina Yakub Shah Alam Associate Diploma in Interactive Multimedia
STUDENT (Student_ID, Student_name, Address,Course)

SUBJECT
Subject_code Subject_name Credit_hour
ACT410 Computerised Accounting, 4
ART310 Graphic Communication 4
ART410 Promotion Design 4
ART230 Introduction to graphic Design 2
BUS210 Business Organization 4
QDM101 Internet Publishing 4
ART210 Graphic Design Application 4
SUBJECT(Subject_code, Subject_name, Credit_hour)

COURSE
Course Coordinator
Diploma in Information Technology Fazilah
Diploma in Computer Graphic Design Ahmad
Associate Diploma in Interactive Multimedia Sahada
COURSE (Course, Coordinator)

STUDENT_GRADE
Student_ID Subject_code Grade
S0001 ACT410 A
S0001 ADM101 B
S0001 ART210 C
S0144 ART310 A
S0144 ART230 B
S0144 BUS210 B
S0151 ART410 C
S0151 ART 210 A
S0151 BUS210 A
STUDENT_GRADE (Student_ID, Subject_code, Grade)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 2 :
Langkah-Langkah Penormalan

Jadual dengan kumpulan data yang


berulang Hapuskan kumpulan data yang berulang
(Unnormalised Form (UNF)) (rujuk Nota 2.1)
(rujuk jadual 2.1)

Bentuk Normal Pertama (First


normal Form (1NF)) Kenal pasti Kesandaran Fungsian.
(rujuk jadual 2.2) (rujuk Nota 2.2)

Bentuk Normal Kedua


(Second Normal Form (2NF))
(rujuk jadual 2.3)
Hapuskan Kesandaran Transitif
(rujuk nota 2.3)
Bentuk Normal Ketiga
(Third Normal Form (3NF))
(rujuk jadual 2.4)

Example 2 :

Table with repeating groups /


Unnormalised Form (UNF). Remove repeating groups
(refer table 2.1) (refer Note 2.1)

First normal form (1NF)


(refer table 2.2) Identify Functional Dependencies.
(refer Note 2.2)

Second Normal Form (2NF)


(refer table 2.3)
Remove Transitive Dependencies
(refer note 2.3)
Third Normal Form (3NF)
(refer table 2.4)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 2.1 / Table 2.1 :


Jadual Unnormalised (UNF) / Unnormalised Table (UNF)

INVOICE
Customers Customer Address Item Item Qty Price Supplier Supplier
no name code desc _Address
A100 Abu Sentul KB100 Keyboard 20 25 XYZ Ent Petaling Jaya
CP200 CPU 10 650 XYZ Ent Petaling Jaya
MS112 Mouse 2 15 XYZ Ent. Petaling Jaya

A101 Salmah Ampang HD200 Hard Disk 10 100 Seagate Pulau Pinang
KB100 Keyboard 10 25 XYZ Ent Petaling Jaya
SP360 Speaker 5 45 XYZ Ent Petaling Jaya

102 Rani Ampang MS112 Mouse 4 15 XYZ Ent Petaling Jaya


CP200 CPU 2 650 XYZ Ent Petaling Jaya
VG400 VGA Card 2 200 XYZ Ent Petaling Jaya
INVOICE (Customer_no, Customer_name, Address, Item_code, Item_desc, Qty, Price, Supplier, Supplier_address)

Jadual di atas menunjukkan Kod_item, Item_desc, Qty, Harga, Pembekal dan Alamat_Pembekal adalah medan
yang mengandungi data yang berulang (repeating value).
Andaian : Satu pembekal boleh membekalkan lebih daripada satu item

The table above shows that Item_code, Item_desc, Qty, Price, Supplier & Supplier_address fields contain
multiple or repeating values.
Assumption : One supplier supply many products.

Nota 2.1: Note 2.1:


Masalah yang berlaku di dalam jadual yang Problems that occur in table with repeating groups
mempunyai nilai berulang: :
Susah untuk mengetahui dengan tepat
It’s hard to know exactly which Item_Code
Item_Code bagi Item_Desc tertentu.
belongs to which Item_Desc.
Susah untuk mencari rekod di dalam jadual.
To find a record in the table is very difficult.

Bagaimana untuk Mengatasi Masalah Kumpulan


Data Berulang? How to handle Repeating Groups?

Masalah Kumpulan data berulang boleh di The repeating group can be handled by
separating Unnormalised Form (UNF) into
atasi dengan menukarkan Unnormalised Form
First Normal Form (1NF) as shown later.
(UNF) kepada First Normal Form (1NF).
(Seperti jadual di bawah)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 2.2 / Table 2.2


Bentuk Normal Pertama (1NF) / First Normal Form (1NF)

CUSTOMER
Customer_no Customer_name Address
A100 Abu Sentul
A101 Salmah Ampang
A102 Rani Ampang
CUSTOMER (Customer_No,Customer_name,Address)

INVOICE
Customer_no Item_code Item_desc Qty Price Supplier Supplier_address

A100 KB100 Keyboard 20 25 XYZ Ent. Petaling Jaya


A100 CP200 CPU 10 650 XYZ Ent. Petaling Jaya
A100 MS112 Mouse 2 15 XYZ Ent. Petaling Jaya
A101 HD200 Hard Disc 10 100 Seagate Pulau Pinang
A101 KB100 Keyboard 10 25 XYZ Ent. Petaling Jaya
A101 SP360 Speaker 5 45 XYZ Ent. Petaling Jaya
A102 MS112 Mouse 4 15 XYZ Ent. Petaling Jaya
A102 CP200 CP 2 200 XYZ Ent. Petaling Jaya
A102 VG400 VGA Card 2 650 XYZ Ent. Petaling Jaya
INVOICE (Customer_no, Item_code, item_desc, Qty, Price, Supplier, Supplier_address)

Jadual di atas menunjukkan setiap baris mengandungi satu nilai.


The table above shows that each row contains a single value.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Nota 2.2 / Note 2.2


Mengenal pasti Kesandaran Fungsian / Identify Functional Dependencies.

Kesandaran Fungsian
Kesandaran fungsian menjelaskan tentang perhubungan di antara atribut di dalam relation.

Kesandaran fungsian adalah hubungan di antara atribut di mana satu atau sekumpulan atribut boleh mengenal
pasti atribut lain dalam table yang sama.

What is Functional Dependencies?


Functional Dependencies describe relationships between attributes in a relation.

A relationship between attributes in which one attribute or group of attribute determines the value of another in
the same table.

Customer_no Customer_name Address

Customer_no Item_code Item_desc Qty Price Supplier Supplier_address

Customer_no Customer_name, Address,


Item_code Item_desc, Price, Supplier,Supplier_Address
Customer_no, Item_code Qty

Berdasarkan kepada 3 kesandaran fungsian di atas, terdapat 3 jadual (relation) dalam bentuk normal
kedua (2NF).
Based on these 3 functional dependencies, there will be 3 tables (relations) in 2NF.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 2.3 / Table 2.3

Bentuk Normal Kedua (2NF) / Second Normal Form (2NF)

CUSTOMER
Customer_no Customer_name Address
A100 Abu Sentul
A101 Salmah Ampang
A102 Rani Ampang
CUSTOMER (Customer_no, Customer_name, Address)

ITEM
Item_code Item_desc Price Supplier Supplier_Address

KB100 Keyboard 25 XYZ Ent. Petaling Jaya


HD200 Hard Disc 100 Seagate Pulau Pinang

MS112 Mouse 15 XYZ Ent. Petaling Jaya


SP360 Speaker 45 XYZ Ent. Petaling Jaya
CP200 CPU 650 XYZ Ent. Petaling Jaya
VG400 VGA Card 400 XYZ Ent. Petaling Jaya
ITEM (Item_code, Item_desc, Price, Supplier, Supplier_Address)

INVOICE
Customer_no Item_code Qty

A100 KB100 20
A100 CP200 10
A100 MS112 2

A101 HD200 10
A101 KB100 10
A101 SP360 5
A102 MS112 4
A102 CP200 2
A102 VG400 2
INVOICE (Customer_no, Item_code, Qty)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Nota 2.3:

Kesandaran Transitif (Transitive Dependencies)


Kesandaran fungsian di antara 2 atau lebih atribut bukan kunci (non key attribute). Satu keadaan di mana
atribut bergantung kepada atribut bukan kunci (non primary key) yang lain.
Satu hubungan berada dalam Bentuk Normal Ketiga (3NF) sekiranya hubungan itu berada dalam bentuk
normal kedua (2NF) dan tidak ada kesandaran transitif.
Atribut bukan kunci primer (non primary key) bergantung kepada atribut bukan kunci primer yang lain.

Nota 2.3:

Transitive Dependency
A functional dependency between 2 or more non-key attributes. A condition in which an attribute is
dependent on another attributes that is not part of the primary key.
A relation is in Third Normal Form (3NF) if it is in 2NF and has no transitive dependency.
Non-primary key attribute is functionally dependent on another non-primary key attribute.

Kenal pasti Kesandaran Transitif / Identify Functional Dependencies.

Customer_no Customer_name Address

Kesandaran transitif / Transitive Dependencies

Customer_no Item_code Item_desc Qty Price Supplier Supplier Address

Customer_no Cust_Name, Cust_Address


Customer_No, Item_Code Qty
Item_Code Item_Desc, Price, Supplier, Supplier_address

Kesandaran transitif / Transitive Dependencies

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Penyelesaian: Untuk membangunkan Jadual Bentuk Normal ketiga (3NF), anda dikehendaki menghapuskan
kesandaran transitif.

Solution: In order to build 3NF table (relation), you have to remove the transitive dependencies.

Item_code Item_desc, Price, Supplier,Supplier_address

Kesandaran transitif / Transitive Dependencies

Hasil / Becomes

Akan membentuk 2 relations


Item_code Item_desc, Price,Supplier
/ 2 table (relation)
Supplier Supplier_address are created

Oleh itu, terdapat 4 jadual dalam bentuk normal ketiga (3NF) seperti yang ditunjukkan di bawah:

So, there will be 4 tables in 3NF as shown below:

Customer_no Customer_name, Address


Customer_no, Item_code Qty
Item_code Item_desc,Price, Supplier
Supplier Supplier_address

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 2.4 / Table 2.4


Bentuk Normal Ketiga (3NF) / Third Normal Form (3NF)

CUSTOMER
Customer_no Customer_name Address
A100 Abu Sentul
A101 Salmah Ampang
A102 Rani Ampang
CUSTOMER (Customer_no, Customer_name, Address)

INVOICE
Customer_no Item_code Qty

A100 KB100 20

A100 CP200 10
A100 MS112 2

A101 HD200 10

A101 SP360 5
A101 KB100 10
A102 MS112 4
A102 CP200 2
A102 VG400 2
INVOICE (Customer_no, Item_code, Qty)

ITEM
Item_code Item_desc Price Supplier

KB100 Keyboard 25 XYZ Ent.

HD200 Hard Disc 100 Seagate

MS112 Mouse 15 XYZ Ent.


SP360 Speaker 45 XYZ Ent.
CP200 CPU 650 XYZ Ent.
VG400 VGA Card 200 XYZ Ent.
ITEM (Item_code, Item_desc,Price, Supplier)

SUPPLIER
Supplier Supplier_address

XYZ Ent. Petaling Jaya

Seagate Pulau Pinang

Supplier (Supplier, Supplier_address)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 3:

Langkah-Langkah Penormalan

Jadual dengan kumpulan data yang


berulang Hapuskan kumpulan data yang berulang .
(Unnormalised Form (UNF)). (rujuk Nota 3.1)
(rujuk jadual 3.1)

Bentuk Normal Pertama (First


normal Form (1NF)) Kenal pasti Kesandaran Fungsian.
(rujuk jadual 3.2) (rujuk Nota 3.2)

Bentuk Normal Kedua


(Second Normal Form (2NF))
(rujuk jadual 3.3)
Hapuskan Kesandaran Transitif
(rujuk nota 3.3)

Bentuk Normal Ketiga


(Third Normal Form (3NF))
(rujuk jadual 3.4)

Example 3 :

The Steps in Normalisation

Table with repeating groups (UNF)


(refer table 3.1)
Remove repeating groups
(refer note 3.1)

First normal form (1NF)


(refer table 3.2)
Identify Functional Dependencies
(refer note 3.2)
Second normal form (2NF)
(refer table 3.3)

Remove Transitive Dependencies


Third normal form (3NF) (refer note 3.3)
(refer table 3.4)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 3.1 / Table 3.1

Jadual Unnormalised (UNF) / Unnormalised Form (UNF)

PROJECT
Project_no Project_name Staff_no Staff_name Job_classification Charge_hour Hour

1 DADD 00689 Samat Elect.Engineer RM 20 20


00500 Ali Web Developer RM 22 18
00444 Azie Web Developer RM 22 15

2 Programming 00123 Kamal System Analyst RM 25 30


00999 Hazlim Technical Support RM 16 56

3 Multimedia 00689 Samat Elect.Engineer RM 20 40


00111 Anaz Programmer RM 18 35

PROJECT (Project_no, Staff_no, Project_name, Staff_name, Job_classification, Charge_hour, Hour)

Jadual di atas menunjukkan Staff_no, Staff_name, Job_classification, Charge_hour dan Hour adalah field yang
mengandungi data yang berulang (repeating value).

The above table shows fields (Staff_no, Staff_name, Job_classification, Charge_hour & Hour) which have
Repeating Values.

Nota 3.1: Note 3.1:


Masalah yang berlaku di dalam jadual yang Problems that occur in tables with repeating
mempunyai kumpulan (nilai ) berulang : groups :
Sukar untuk mengetahui dengan tepat
It’s hard to know exactly which Staff_no
charge_hour bagi pekerja.
belongs to which Staff_name.
Sukar untuk mencari rekod di dalam jadual.
To find a record in the table is very difficult.

Bagaimana untuk Mengatasi Masalah Kumpulan How to handle Repeating Groups?


Data Berulang?
The repeating groups can be handled by
Masalah Kumpulan data berulang boleh di atasi
separating Unnormalised Form (UNF) into First
dengan menukarkan Unnormalised Form (UNF)
Normal Form (1NF) as shown later.
kepada First Normal Form (1NF). (Seperti jadual di
bawah).

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 3.2 / Table 3.2


Bentuk Normal Pertama (1NF) / First Normal Form (1NF)

PROJECT
Project_no Project_ Staff_no Staff_name Job_ Charge_ hour
name classification hour
1 DADD 00689 Samat Elect.Engineer RM 20 20

1 DADD 00500 Ali Web Developer RM 22 18


1 DADD 00444 Azie Web Developer RM 22 15
2 Programming 00123 Kamal System Analyst RM 25 30
2 Programming 00999 Hazlim Technical RM 16 56
Support
3 Multimedia 00689 Samat Elect.Engineer RM 20 40
3 Multimedia 00111 Anaz Programmer RM 18 35

PROJECT (Project_no, Staff_no, Project_name, Staff_name, Job_classification, Charge_hour, Hour)

Jadual di atas menunjukkan setiap baris mengandungi satu nilai.


The above table shows that each row has its own value.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Nota 3.2: / Note 3.2:


Kesandaran Fungsian
Kesandaran fungsian menjelaskan tentang perhubungan di antara atribut di dalam relation.

Kesandaran fungsian adalah hubungan di antara atribut di mana satu atau sekumpulan atribut boleh mengenal
pasti atribut lain dalam table yang sama.

What is Functional Dependencies?


Functional Dependencies describe relationships between attributes in a relation.

A relationship between attributes in which one attribute or group of attribute determines the value of another in
the same table.

Mengenal pasti Kesandaran Fungsian / Identify Functional Dependencies

Project_no Project_name Staff_no Staff_name Job_classification Charge_hour Hour

Project_no Project_name
Staff_no Staff_name, Job_classification, Charge_hour
Staff_no, Project_no Hour

Berdasarkan kepada 3 kesandaran fungsian di atas, terdapat 3 jadual (relation) dalam bentuk normal kedua
(2NF).

Based on these 3 functional dependencies, there will be 3 tables (relations) in 2NF.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 3.3 / Table 3.3 :

Bentuk Normal Kedua (2NF) / Second Normal Form (2NF)

PROJECT
Project_no Project_name
1 DADD
2 Programming
3 Multimedia
PROJECT (Project_no, Project_name)

STAFF
Staff_no Staff_name Job_classification Charge_hour

00689 Samat Elect.Engineer RM 20

00500 Ali Web Developer RM 22

00444 Azie Web Developer RM 22


00123 Kamal System Analyst RM 25
00999 Hazlim Technical Support RM 16
00111 Anaz Programmer RM 18
STAFF (Staff_no, Staff_name, Job_classification, Charge_hour)

HOUR
Staff_no Project_no Hour

00689 1 20

00500 1 18
00444 1 15

00123 2 30

00999 2 56
00689 3 40
00111 3 35
HOUR (Staff_no, Project_no, Hour)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Nota 3.3:

Kesandaran Transitif (Transitive Dependencies)


Kesandaran fungsian di antara 2 atau lebih atribut bukan kunci (non key attribute). Satu keadaan di mana
atribut bergantung kepada atribut bukan kunci (non primary key) yang lain.
Satu hubungan berada dalam Bentuk Normal Ketiga (3NF) sekiranya hubungan itu berada dalam bentuk
normal kedua (2NF) dan tidak ada kesandaran transitif.
Atribut bukan kunci primer (non primary key) bergantung kepada atribut bukan kunci primer yang lain.

Note 3.3:

Transitive Dependency
A functional dependency between 2 or more non-key attributes. A condition in which an attribute is
dependent on another attribute that is not part of the primary key.
A relation is in Third Normal Form (3NF) if it is in 2NF and has no transitive dependency.
Non-primary key attribute is functionally dependent on another non-primary key attribute.

Kenal pasti Kesandaran Transitif / Identify Transitive Dependencies

Kesandaran transitif / Transitive Dependencies

Project_no Project_name Staff_no Staff_name Job_classification Charge_hour Hour

Project_no Project_name
Staff_no Staff_name, Job_classification, Charge_hour
Staff_no, Project_no Hour

Kesandaran transitif / Transitive Dependencies

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Penyelesaian: untuk membangunkan Jadual Bentuk Normal ketiga (3NF), anda dikehendaki menghapuskan
kesandaran transitif.

Solution: In order to build 3NF table (relation), you have to remove the transitive dependencies.

Staff_no Staff_name, Job_classification, Charge_hour

Kesandaran transitif / Transitive Dependencies

Becomes

Staff_no Staff_name, Job_classification 2 tables


Job_classification Charge_hour (relation) are
created

Oleh itu, terdapat 4 jadual dalam bentuk normal ketiga (3NF) seperti yang ditunjukkan di bawah:
So, there will be 4 tables in 3NF as shown below:

Project_no Project_name
Staff_no, Project_no Hour
Staff_no Staff_name, Job_classification
Job_classification Charge_hour

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Jadual 3.4 / Table 3.4


Bentuk Normal Kedua (3NF) / Third Normal Form (3NF)

PROJECT
Project_no Project_name
1 DADD
2 Programming
3 Multimedia
PROJECT (Project_no, Project_name)

STAFF
Staff_no Staff_name Job_classification

00689 Samat Elect.Engineer

00500 Ali Web Developer

00444 Azie Web Developer


00123 Kamal System Analyst
00999 Hazlim Technical Support
00111 Anaz Programmer
STAFF (Staff_no, Staff_name, Charge_hour, Job_classification)

HOUR
Staff_no Project_no Hour

00689 1 20

00500 1 18
00444 1 15

00123 2 30

00999 2 56
00689 3 40
00111 3 35
HOUR (Staff_no, Project_no, Hour)

JOB
Job_classification Charge_hour

Elect.Engineer RM 20

Web Developer RM 22
System Analyst RM 25
Technical Support RM 16
Programmer RM 18
JOB (Job_classification, Charge_hour)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 4 / Example 4:

Berdasarkan rajah di bawah, normalkan sehingga peringkat ketiga (UNF – 3NF). Normalised the table below from
UNF to 3NF.

StaffID Name Dept Salary CourseID CourseTitle EndDate


100 Margaret Simpson Marketing 48000 101 SPSS 19 Jul 2003
102 Surveys 10 Aug 2003

140 Alan Beeton Accounting 52000 103 Tax Acc 8 Dec 2003
110 Chris Lucera Info Systems 43000 101 SPSS 1 Dec 2003
104 C++ 14 Nov 2003
190 Lorenzo Davis Finance 55000
150 Susan Martin Marketing 42000 101 SPSS 16 Jun 2003
105 Java 12 Aug 2003

UNF

COURSE (StaffID, Name, Dept, Salary, CourseID, CourseTitle, EndDate)

Jadual dalam UNF mempunyai data yang berulang dan ianya perlu ditukarkan ke 1NF . / Table in UNF consist of
redundant data and it must be transform to 1NF.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Bentuk Normal Pertama (1NF) / First Normal Form (1NF)

STAFF
StaffID Name Dept Salary
100 Margaret Simpson Marketing 48000
110 Chris Lucera Info Systems 43000
140 Alan Beeton Accounting 52000
190 Lorenzo Davis Finance 55000
150 Susan Martin Marketing 42000
STAFF ( StaffID, Name, Dept, Salary)

COURSE
StaffID CourseID CourseTitle EndDate
100 101 SPSS 19 Jul 2003
100 102 Surveys 10 Aug 2003
110 101 SPSS 1 Dec 2003
110 104 C++ 14 Nov 2003
140 103 Tax Acc 8 Dec 2003
190
150 101 SPSS 16 Jun 2003
150 105 Java 12 Aug 2003
COURSE (StaffID, CourseID, CourseTitle, EndDate)

Jadual 1NF adalah keadaan di mana setiap atributnya tidak mengandungi nilai yang berulang (satu nilai sahaja). /
Table in 1NF is the situation where the intersection of each row and column contains no repeating values (only
one value).

Jadual 1NF perlu ditukar ke 2NF dengan mengenal pasti kesandaran fungsian . / Table in 1NF must be transform
to 2NF by identify the functional dependencies.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Kesandaran Fungsian
Kesandaran fungsian menjelaskan tentang perhubungan di antara atribut di dalam relation.

Kesandaran fungsian adalah hubungan di antara atribut di mana satu atau sekumpulan atribut boleh mengenal
pasti atribut lain dalam table yang sama.

What is Functional Dependencies?


Functional Dependencies describe relationships between attributes in a relation.

A relationship between attributes in which one attribute or group of attribute determines the value of another in
the same table.

Mengenal pasti Kesandaran Fungsian / Identify Functional Dependencies

StaffID Name Dept Salary

StaffID CourseID CourseTitle EndDate

Berdasarkan kepada kesandaran fungsian di atas, terdapat 3 jadual (relation) dalam bentuk normal kedua (2NF).
Based on these 3 functional dependencies, there will be 3 tables (relations) in 2NF.

StaffID Name, Dept, Salary


StaffID, CourseID EndDate
CourseID CourseTitle

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Bentuk Normal Kedua (2NF) / Second Normal Form (2NF)

STAFF
StaffID Name Dept Salary
100 Margaret Simpson Marketing 48000
110 Chris Lucera Info Systems 43000
140 Alan Beeton Accounting 52000
190 Lorenzo Davis Finance 55000
150 Susan Martin Marketing 42000
STAFF ( StaffID, Name, Dept, Salary)

STAFFCOURSE
StaffID CourseID EndDate
100 101 19 Jul 2003
100 102 10 Aug 2003
110 101 1 Dec 2003
110 104 14 Nov 2003
140 103 8 Dec 2003
190
150 101 16 Jun 2003
150 105 12 Aug 2003
COURSE (StaffID, CourseID, EndDate)

COURSE
CourseID CourseTitle
101 SPSS
102 Surveys
101 SPSS
104 C++
103 Tax Acc

101 SPSS
105 Java
COURSE (CourseID, CourseTitle)

Jadual 2NF perlu ditukar ke 3NF dengan mengenal pasti kesandaran transitif . / Table in 1NF must be transform to
2NF by identify the transitive dependency.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Kesandaran Transitif (Transitive Dependencies)


Kesandaran fungsian di antara 2 atau lebih atribut bukan kunci (non key attribute). Satu keadaan di mana
atribut bergantung kepada atribut bukan kunci (non primary key) yang lain.
Satu hubungan berada dalam Bentuk Normal Ketiga (3NF) sekiranya hubungan itu berada dalam bentuk
normal kedua (2NF) dan tidak ada kesandaran transitif.
Atribut bukan kunci primer (non primary key) bergantung kepada atribut bukan kunci primer yang lain.

Transitive Dependency
A functional dependency between 2 or more non-key attributes. A condition in which an attribute is
dependent on another attributes that is not part of the primary key.
A relation is in Third Normal Form (3NF) if it is in 2NF and has no transitive dependency.
Non-primary key attribute is functionally dependent on another non-primary key attribute.

Kenal pasti Kesandaran Transitif / Identify Transitive Dependencies

StaffID Name Dept Salary

StaffID CourseID EndDate

CourseID CourseTitle

Tidak ada kesandaran transitif dalam relation tersebut / There is no transitive dependencies in the relation.

3NF adalah / 3NF are :

STAFF ( StaffID, Name, Dept, Salary)


COURSECOURSE (StaffID, CourseID, EndDate)
COURSE (CourseID, CourseTitle)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 5: / Example 5:
Normalkan borang di bawah sehingga ke tahap penormalan ke tiga (3NF). Berikan jawapan anda dalam bentuk
skema hubungan.

Normalise the following form to Third Normal Form (3NF). You are required to show the normalisation steps
taken. Provide your answer in a relation scheme.

NZ SDN. BHD
RECEIPT OF HOUSE RENTAL PAYMENT

TENANT’S NAME : Nurul Atiqah TENANT’S CODE: 123

House_code Address Start_ End_date Rental Landlord_ Landlord


date code _name

PG 3 No. 6 1/7/1995 31/7/1997 RM 600 T0069 Intan bt.


Taman Jaafar
Tenaga,
Kajang
PG 14 No. 5 1/8/1997 1/8/1999 RM 650 T8881 Noor bt.
Taman Nazri
Cahaya,
Cheras

Penyelesaian:
Langkah-langkah:
Berikan nama hubungan (relation) yang sesuai.
Senaraikan semua atribut yang terdapat di dalam borang tersebut.

Solution:
The Steps in Normalisation:
Name the appropriate relation name.
List down all attributes involved.

Format Skema Hubungan: / Relation Scheme Format:

Nama_relation (Kunci Primer, Atribut Bukan Kunci)

Relation Name (Primary Key, Non-key Attributes)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

a) Bentuk Tidak Normal (UNF) / Unnormalised Form (UNF)

Skema hubungan dalam Bentuk Tidak Normal (UNF): / Relation scheme in an Unnormalised Form :

RENTAL (Tenant_code, Tenant_name, House_code, Address, Start_date, End_date, Rental, Landlord_code,


Landlord_name)

b) Bentuk Normal Pertama (1NF) / First Normal Form (1NF)


Pastikan relation (table) tidak mempunyai data berulang. / Make sure there is no redundant data in relation.
Gariskan kunci primer / Underline Primary Key.

Skema hubungan dalam bentuk 1NF: / Relation Scheme in 1NF:

CUSTOMER(Tenant_code, Tenant_name)

RENTAL (Tenant_code, House_code, Address, Start_date, End_date, Rental, Landlord_code, Landlord_name)

c) Bentuk Normal Kedua (2NF) / Second Normal Form (2NF)


Tentukan Kesandaran Fungsian (hubungan di antara atribut di dalam sesuatu relation.) / Identify the Functional
Dependencies (relationship among attributes in a relation).

Mengenal pasti Kesandaran Fungsian: / Identify Functional Dependencies

CUSTOMER(Tenant_code, Tenant_name)

RENTAL (Tenant_code, House_code, Address, Start_date, End_date, Rental, Landlord_code, Landlord_name)

Kesandaran fungsian / Functional dependencies

Relation Scheme in 2NF:

CUSTOMER(Tenant_code, Tenant_name)

RENTAL (Tenant_code, House_code, Start_date, End_date)

HOUSE (House_code, Address, Rental, Landlord_code, Landlord_name)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

d) Bentuk Normal Ketiga (3NF) / Third Normal Form (3NF)

Kenalpasti Kesandaran Transitif / Identify Transitive Dependencies

CUSTOMER(Tenant_code, Tenant_name)

RENTAL (Tenant_code, House_code, Start_date, End_date)

HOUSE (House_code, Address, Rental, Landlord_code, Landlord_name)

Kesandaran transitive / Transitive dependency

Skema Hubungan 3NF / Relation Scheme in 3NF:

CUSTOMER(Tenant_code, Tenant_name)

RENTAL (Tenant_code, House_code, Start_date, End_date)

HOUSE (House_code, Address, Rental, Landlord_code)

LANDLORD (Landlord_code, Landlord_name)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 6 / Example 6 :
Normalkan borang di bawah sehingga ke tahap penormalan ke tiga (3NF). /Normalise the following form to Third
Normal Form (3NF).

KOLEJ MILENNIUM
GRADE REPORT
SEMESTER MAY – AUGUST 2002

Name : Emily Williams Major : MIS


Student No : 053-6929-24 Status : Senior
Address : 208 Brooks Hall

Subject Code Subject Name Professor ProfDept Grade


MIS 403 System Analysis Kendall, K DESC A
MIS 411 Conceptual Kendall, J DESC A
Foundations
MIS 420 Human Factors Kendall, J DESC B
in IS
CIS 412 Database Design Sibley, E CIS A
DESC 353 Management Kelly, D DESC A
Models

Penyelesaian:
Langkah-langkah:
Berikan nama hubungan (relation) yang sesuai.
Senaraikan semua atribut yang terdapat di dalam borang tersebut.

Solution:
The Steps in Normalisation:
Name the appropriate relation name.
List down all attributes involved.

Format Skema Hubungan: / Relation Scheme Format:

Nama_relation (Kunci Primer, Atribut Bukan Kunci)

Relation Name (Primary Key, Non-key Attributes)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

a) Bentuk Tidak Normal (UNF) / Unnormalised Form (UNF)

Skema hubungan dalam Bentuk Tidak Normal (UNF): / Relation scheme in an Unnormalised Form :

STUDENT (Name, StudentNo, Address, Major, Status, Subject Code, SubjectName, Professor, ProfDept, Grade, Semester)

c) Bentuk Normal Pertama (1NF) / First Normal Form (1NF)


Pastikan relation (table) tidak mempunyai data berulang. / Make sure there is no redundant data in relation.
Gariskan kunci primer / Underline Primary Key.

Skema hubungan dalam bentuk 1NF: / Relation Scheme in 1NF:

STUDENT (StudentNo, Name, Address, Major, Status)

STUDENTSUBJECT (StudentNo, Subject Code, SubjectName, Professor, ProfDept, Grade, Semester)

c) Bentuk Normal Kedua (2NF) / Second Normal Form (2NF)


Tentukan Kesandaran Fungsian (hubungan di antara atribut di dalam sesuatu relation.) / Identify the Functional
Dependencies (relationship among attributes in a relation).

Mengenal pasti Kesandaran Fungsian:

STUDENT (StudentNo, Name, Address, Major, Status)

STUDENTSUBJECT (StudentNo, Subject Code, SubjectName, Professor, ProfDept, Grade, Semester)

Kesandaran fungsian / Functional dependency

Skema Hubungan 2NF / Relation Scheme in 2NF:

STUDENT (StudentNo, Name, Address, Major, Status)

GRADEREPORT (StudentNo, Subject Code, Grade, Semester)

SUBJECT (Subject Code, SubjectName, Professor, ProfDept)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

d) Bentuk Normal Ketiga (3NF) / Third Normal Form (3NF)

Kenal pasti Kesandaran Transitif / Identify Transitive Dependencies

STUDENT (StudentNo, Name, Address, Major, Status)

GRADEREPORT (StudentNo, Subject Code, Grade, Semester)

SUBJECT (Subject Code, SubjectName, Professor, ProfDept)

Kesandaran transitive / Transitive dependency

Skema Hubungan 3NF / Relation Scheme in 3NF:

STUDENT (StudentNo, Name, Address, Major, Status)

GRADEREPORT (StudentNo, Subject Code, Grade, Semester)

SUBJECT (Subject Code, SubjectName, Professor)

PROF (Professor, ProfDept)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

Contoh 7 / Example 7 :
Normalkan borang di bawah sehingga ke tahap penormalan ke tiga (3NF). /Normalise the following form to Third
Normal Form (3NF).

AR SDN BHD
32, JALAN KELANA,
50567 PETALING JAYA,
SELANGOR DARUL EHSAN
NO TEL : 03-7552525

CustomerNo : PNOO65 Invoice No : KS2345


Name : Ferhad Ibrahim Date : 2/3/2003
Address : Jalan Klang Lama
Tel No : 03 -2235990

ProductCode ProductName PriceUnit Quantity Discount SubTotal

A2345 Book 2.00 100 10% 180.00


B1235 Pen 0.25 500 125.00
D4568 Eraser 0.1 200 20.00
Total 325.00

Penyelesaian:
Langkah-langkah:
Berikan nama hubungan (relation) yang sesuai.
Senaraikan semua atribut yang terdapat di dalam borang tersebut.

Solution:
The Steps in Normalisation:
Name the appropriate relation name.
List down all attributes involved.

Format Skema Hubungan: / Relation Scheme Format:

Nama_relation (Kunci Primer, Atribut Bukan Kunci)

Relation Name (Primary Key, Non-key Attributes)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

a) Bentuk Tidak Normal (UNF) / Unnormalised Form (UNF)

Skema hubungan dalam Bentuk Tidak Normal (UNF): / Relation scheme in an Unnormalised Form :

INVOICE (InvoiceNo, Date, CustomerNo, Name, Address, TelNo, ProductCode, ProductName, PriceUnit, Quantity,
Discount, Subtotal)

b) Bentuk Normal Pertama (1NF) / First Normal Form (1NF)


Pastikan relation (table) tidak mempunyai data berulang. / Make sure there is no redundant data in relation.
Gariskan kunci primer / Underline Primary Key.

Skema hubungan dalam bentuk 1NF: / Relation Scheme in 1NF:

INVOICE (InvoiceNo, Date, CustomerNo, Name, Address, TelNo)

PRODUCT (InvoiceNo , ProductCode, ProductName, PriceUnit, Quantity, Discount, Subtotal)

c) Bentuk Normal Kedua (2NF) / Second Normal Form (2NF)


Tentukan Kesandaran Fungsian (hubungan di antara atribut di dalam sesuatu relation.) / Identify the Functional
Dependencies (relationship among attributes in a relation).

Mengenal pasti Kesandaran Fungsian:

INVOICE (InvoiceNo, Date, CustomerNo, Name, Address, TelNo)

PRODUCT (InvoiceNo ,ProductCode, ProductName, PriceUnit, Quantity, Discount, Subtotal )

Kesandaran fungsian / Functional dependency

Skema Hubungan 2NF / Relation Scheme in 2NF:

INVOICE (InvoiceNo, Date, CustomerNo, Name, Address, TelNo)

PRODUCT (ProductCode, ProductName, PriceUnit )

ORDER (InvoiceNo, ProductCode, Quantity, Discount, Subtotal )

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

d) Bentuk Normal Ketiga (3NF) / Third Normal Form (3NF)

Kenal pasti Kesandaran Transitif / Identify Transitive Dependencies

INVOICE (InvoiceNo, Date, CustomerNo, Name, Address, TelNo)


Kesandaran transitif /
Transitive dependency

PRODUCT (ProductCode, ProductName, PriceUnit )

ORDER (InvoiceNo, ProductCode, Quantity, Discount, Subtotal )

Skema Hubungan 3NF / Relation Scheme in 3NF:

PRODUCT (ProductCode, ProductName, PriceUnit )

ORDER (InvoiceNo, ProductCode, Quantity, Discount, Subtotal )

INVOICE (InvoiceNo, Date, CustomerNo)

CUSTOMER (CustomerNo, Name, Address, TelNo)

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

RINGKASAN BAB 3 : PENORMALAN

 RELATION adalah satu jadual 2 dimensi yang mempunyai lajur dan baris.

 Skema hubungan adalah senarai atribut yang terkandung dalam hubungan (relation).

 Format bagi skema hubungan :


Format : Nama Relation (Kunci Primer, Atribut Bukan Kunci)

 2 masalah dalam relational data model :


Anomali
Pertindanan maklumat

 Anomali adalah ralat yang mungkin berlaku apabila pengguna ingin mengemas kini jadual
yang mengandungi data yang berulang.

 Penormalan adalah satu proses untuk menempatkan atribut ke dalam jadual bagi
mengelakkan masalah anomali dan pertindanan maklumat.

 3 tahap penormalan :
1 NF
2 NF
3 NF

 1 NF adalah satu relation di mana setiap atribut tidak mengandungi nilai yang berulang.

 2 NF adalah satu relation dalam 1 NF dan setiap atribut bukan kunci primer adalah
bersandar sepenuhnya kepada kunci primer.

 3 NF adalah satu relation dalam 2 NF dan bersandarkan kepada konsep kesandaran


transitif.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

RINGKASAN BAB 3 : PENORMALAN

 Langkah-langkah penormalan :

Jadual Dengan Kumpulan Data Yang


Berulang Hapuskan kumpulan data yang
Unnormalised Form berulang

Bentuk Normal Pertama (BN1)


(First Normal Form (1NF))
Kenal pasti Kesandaran
Fungsian
Bentuk Normal Kedua (BN2) (Second
Normal Form (2NF))

Hapuskan
Bentuk Normal Ketiga (BN3) kesandaran Transitif
(Third Normal Form (3NF))

 Kesandaran fungsian adalah hubungan di antara atribut di mana satu atau sekumpulan
atribut boleh mengenal pasti atribut lain dalam table yang sama.

 Kesandaran transitif adalah satu keadaan di mana atribut bergantung kepada atribut
bukan kunci yang lain.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

SUMMARY FOR CHAPTER 3 : NORMALIZATION

 A two dimensional table with columns and rows is called a RELATION.

 A relation scheme is a list of attributes and their corresponding domains.

 Format for relation scheme :


Format : Relation Name ( Primary Key, Non Key Attribute)

 2 problems in relational data model :


Anomalies
Information Redundancy

 Anomalies is an errors or inconsistencies that may result when a user attempts to update
a table that contains redundant data.

 Normalization is a process for assigning attributes into table and reduces data
redundancy and helps eliminate the anomalies problems.

 3 level of normalization :
1 NF
2 NF
3 NF

 1 NF is a relation where the intersection of each row and column contains no repeating
values.

 2 NF is a relation that is in 1 NF and every non-primary key attribute is fully functionally


depending on the primary key.

 3 NF is a relation that is in 2 NF and is based on the concept of transitive dependency.

© Prepared by : nurizah@ict.puo.edu.my
NORMALISATION
F4109: DATABASE SYSTEM

SUMMARY FOR CHAPTER 3 : NORMALIZATION

 Steps in normalization :

Table with repeating groups


(Unnormalised Form (UNF))
Remove repeating groups

First normal Form (1NF)

Identify Functional
Dependencies
Second Normal Form (2NF)

Remove Transitive
Third Normal Form (3NF) Dependencies

 Functional dependency is a relationship between attributes in which one attributes or


group of attribute determines the value of another in the same table.

 Transitive dependencies are a condition where an attribute is depend on another attribute


that is not part of the primary key.

© Prepared by : nurizah@ict.puo.edu.my