normalization
TRANSCRIPT
PENORMALAN
NORMALISATION
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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.
Objective
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.
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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.
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 Learning
US
Kunci Primer / Primary Key Atribut Bukan Kunci / Non-primary key (Non key attribute)
Contoh / Example :
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
Baris
(Row / Tuple)
Lajur (Column / Attribute)
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 :
Format:
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:
Nama_relation (Kunci Primer, Atribut Bukan Kunci)
PUBLISHER (Publisher_Code, Name, City)
Relation_name (Primary_key, Non_ Key_Attribute)
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
A001 Ruth Maran
A002 McFadden
A003 Kaufeld John
A004 Curtis Frye
A005 Joe Adamski
A006 Kroenke
A007 Pratt Philip J.
A008 Mardiana, Hasnah
A009 Harrington, T
A010 Connolly, T
BOOK
Book Code
Book_Title Publisher_Code Description Type Price Book_Sample Book_Cover
P01 Access 2000 Processing M-G1 Database 76.00 Yes
P02 Teach Yourself Microsoft Access 2000 Visually
M-G1 Database 80.00 No
P03 Concepts of Database Management System
P-H1 Database 100.00 No
P04 Microsoft Access 2000 Complete
T-H1 Database 59.00 No
P05 Database Processing T-H1 Database 69.00 No
P06 Pengajian Malaysia F-B1 Pengetahuan Am
40.00 No
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 .
Book_Code Author_No
P01 A006
P02 A001
P03 A002
P04 A003
P05 A004
P06 A008
P07 A005
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
a) Anomali Pengemaskinian i) Anomali Pengubahsuaian (Modification Anomalies)
PELAJAR_KURSUS
No_Pelajar Nama_pelajar Alamat Kod_kursus Nama_kursus
S0144 Hamizah Mohamed Redzwan
Jln. Kg. Gajah ASDIM Associate Diploma in Interactive Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru Bangi
CGMP200 Computer Power 200 (Graphic and Multimedia)
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi Polis
CITP100 Computer power 100 (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati CGMP200 Computer Power 200 (Graphic and Multimedia)
S0035 Syed Ahmad Rizal B. Syed Abdul Razak
Jalan Puchong DIPCGR Diploma in Computer 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
Redzwan
Jln. Kg. Gajah ASDIM Associate Diploma in
Interactive
Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru
Bangi
CGMP200 Computer Power 200
(Graphic and
Multimedia)
S0157 Nurazean Bt. Md.
Sobri
Tmn. Koperasi
Polis
CITP100 Computer power 100
(IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati CGMP200 Computer Power 200
(Graphic and
Multimedia)
S0035 Syed Ahmad Rizal B.
Syed Abdul Razak
Jalan Puchong DIPCGR Diploma in Computer
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 Abdul Razak
Jalan Puchong DIPCGR
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
Abdul Razak
Jalan Puchong DIPCGR
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
ii) Anomali Penambahan
PELAJAR_KURSUS
No_Pelajar Nama_pelajar Alamat Kod_kursus Nama_kursus
S0144 Hamizah Mohamed Redzwan
Jln. Kg. Gajah ASDIM Associate Diploma in Interactive Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru Bangi
CGMP200 Computer Power 200 (Grafik dan Multimedia)
S0157 Nurazean Bt. Md. Sobri
Tmn. Koperasi Polis
CITP100 Computer power 100 (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati DIPCGR Diploma in Computer Graphic and Design
S0035 Syed Ahmad Rizal B. Syed Abdul Razak
Jalan Puchong CGMP200 Computer Power 200 (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
Redzwan
Jln. Kg. Gajah ASDIM Associate Diploma in
Interactive
Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru
Bangi
CGMP200 Computer Power 200
(Graphic and
Multimedia)
S0157 Nurazean Bt. Md.
Sobri
Tmn. Koperasi
Polis
CITP100 Computer power 100
(IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati DIPCGR Diploma in Computer
Graphic and Design
S0035 Syed Ahmad Rizal B.
Syed Abdul Razak
Jalan Puchong CGMP200 Computer Power 200
(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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 Abdul Razak
Jalan Puchong DIPCGR
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
Abdul Razak
Jalan Puchong DIPCGR
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
iii) Anomali Penghapusan
PELAJAR_KURSUS
No_Pelajar Nama_pelajar Alamat Kod_kursus Nama_kursus
S0144 Hamizah Mohamed Redzwan
Jln. Kg. Gajah ASDIM Associate Diploma in Interactive Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru Bangi
CGMP200 Computer Power 200 (Grafik dan Multimedia)
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi Polis
CITP100 Computer power 100 (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati DIPCGR Diploma in Computer Graphic and Design
S0035 Syed Ahmad Rizal B. Syed Abdul Razak
Jalan Puchong CGMP200 Computer Power 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
Redzwan
Jln. Kg. Gajah ASDIM Associate Diploma
in Interactive
Multimedia
S0149 Amjadi Abd. Mubin Bandar Baru
Bangi
CGMP200 Computer Power
200 (Graphic and
Multimedia)
S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi
Polis
CITP100 Computer power
100 (IT)
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati DIPCGR Diploma in
Computer Graphic
and Design
S0035 Syed Ahmad Rizal B.
Syed Abdul Razak
Jalan Puchong CGMP200 Computer Power
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 Abdul Razak
Jalan Puchong CGMP200
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
Abdul Razak
Jalan Puchong CGMP200
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
(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
Redzwan
Jln. Kg. Gajah ACT410 Computerised
Accounting
4
S0149 Amjadi Abd. Mubin Bandar Baru Bangi ADM101 Internet
Publishing
4
S0157 Nurazean Bt. Md.
Sobri
Tmn. Koperasi Polis ADM101 Internet
Publishing
4
S0159 Aidil Akmar Hj. Ayob Tmn. Melawati ADM301 Project 4
S0035 Syed Ahmad Rizal B.
Syed Abdul Razak
Jalan Puchong ADM101 Internet
Publishing
4
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
Redzwan
Jln. Kg. Gajah ACT410 Computerised
Accounting
4
S0149 Amjadi Abd. Mubin Bandar Baru
Bangi
ADM101 Internet
Publishing
4
S0157 Nurazean Bt. Md.
Sobri
Tmn. Koperasi
Polis
ADM101 Internet
Publishing
4
S0159 Aidil Akmar Hj.
Ayob
Tmn. Melawati ADM301 Project 4
S0035 Syed Ahmad Rizal
B. Syed Abdul
Razak
Jalan Puchong ADM101 Internet
Publishing
4
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Penyelesaian :
Bagi menyelesaikan masalah di atas, pengguna haruslah mengasingkan relation PELAJAR_SUBJEK
seperti berikut:
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.
Maklumat bagi setiap subjek dipaparkan sekali sahaja dalam
SUBJECT relation dan hanya data mengenai Subject_Code
diulang dalam STUDENT_SUBJECT relation.
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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_
Name
Subject_Name Subject_Code Credit_
Hour
Grade Addr. Course Coor-
dinator
S0001 Azlina Ahmad Computerised
Accounting
Internet Publishing
Graphic Design
Application
ACT410
ADM101
ART210
4
4
4
A
B
C
Sentul Dip. in
Information
Technology
Fazilah
S0144 Amirul Hamdan Graphic
Communication
Introduction to
Graphic Design
Business
Organization
ART310
ART230
BUS210
4
2
4
A
B
B
Shah
Alam
Dip. in
Computer
Graphic
Design
Ahmad
S0151 Maslina Yakub Promotion Design
Graphic Design
Application
Business
Organisation
ART410
ART 210
BUS210
4
4
4
C
A
A
Shah
Alam
Associate
Dip. in
Interactive
Multimedia
Sahada
Data berulang / Repeating data
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
CP200
MS112
Keyboard
CPU
Mouse
20
10
2
25
650
15
XYZ Ent
XYZ Ent
XYZ Ent.
P. Jaya
P. Jaya
P. Jaya
A101 Salmah Ampang HD200
KB100
SP360
Hard Disc
Keyboard
Speaker
10
10
5
100
25
45
Seagate
XYZ Ent
XYZ Ent
P. Pinang
P. Jaya
P. Jaya
102 Rani Ampang MS112
CP200
VG400
Mouse
CPU
VGA Card
4
2
2
15
650
200
XYZ Ent
XYZ Ent
XYZ Ent
P. Jaya
P. Jaya
P. Jaya
Data berulang / Repeating data
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
A100
A100
KB100
CP200
MS112
20
10
2
A101
A101
A101
HD200
KB100
SP360
10
10
5
A102
A102
A102
MS112
CP200
VG400
4
2
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
3.2.1 Langkah-Langkah Penormalan
3.2.1 Steps in Normalisation
Table with repeating groups
(Unnormalised Form (UNF))
First normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
Remove repeating groups
Identify Functional
Dependencies
Remove Transitive
Dependencies
Jadual Dengan Kumpulan Data Yang
Berulang
Unnormalised Form
Bentuk Normal Pertama (BN1) (First
Normal Form (1NF))
Bentuk Normal Kedua (BN2) (Second
Normal Form (2NF))
Bentuk Normal Ketiga (BN3)
(Third Normal Form (3NF))
Hapuskan kumpulan data yang berulang
Kenal pasti Kesandaran Fungsian
Hapuskan kesandaran Transitif
Jadual Dengan Kumpulan Data Yang
Berulang
Unnormalised Form
Bentuk Normal Pertama (BN1)
(First Normal Form (1NF))
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Contoh 1:
Langkah-Langkah Penormalan
Example 1:
Steps in Normalisation
Jadual dengan kumpulan data yang berulang (UNF) . (rujuk jadual 1.1)
Bentuk Normal Pertama (First normal Form (1NF)) (rujuk jadual 1.2)
Bentuk Normal Kedua (Second Normal Form (2NF)) (rujuk jadual 1.3)
Bentuk Normal Ketiga (Third Normal Form (3NF)) (rujuk jadual 1.4)
Hapuskan kumpulan data yang berulang (rujuk Nota 1.1)
Kenal pasti Kesandaran Fungsian. (rujuk Nota 1.2)
Hapuskan Kesandaran Transitif (rujuk nota 1.3)
Table with repeating groups
(Unnormalised Form (UNF))
(refer table 1.1)
(rujuk jadual 1.1)
First normal Form (1NF)
(refer table 1.2)
(Second Normal Form (2NF))
(refer table 1.3)
(Third Normal Form (3NF))
(refer table 1.4)
Remove repeating groups
(refer Note 1.1)
Identify Functional
Dependencies
(refer Note 1.2)
Remove Transitive
Dependencies
(refer Note 1.3)
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Jadual 1.1 / Table 1.1
Jadual Unnormalised (UNF) / Unnormalised Form (UNF)
STUDENT
Student ID Student
Name
Subject Name Subject
Code
Credit
Hours
Grade Address Course Coordinator
S0001 Azlina
Ahmad
Computerised
Accounting
Internet
Publishing
Graphic Design
Application
ACT410
ADM101
ART210
4
4
4
A
B
C
Sentul Diploma in
Information
Technology
Fazilah
S0144 Amirul
Hamdan
Graphic
Communication
Introduction to
graphic Design
Business
Organization
ART310
ART230
BUS210
4
2
4
A
B
B
Shah Alam Diploma in
Computer
Graphic
Design
Ahmad
S0151 Mazlina
Yakub
Promotion
Design
Graphic Design
Application
Business
Organisation
ART410
ART 210
BUS210
4
4
4
C
A
A
Shah Alam Associate
Diploma in
Interactive
Multimedia
Sahada
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.
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.
Nota 1.1:
Masalah yang berlaku di dalam jadual yang mempunyai
kumpulan(nilai) berulang:
Susah untuk mengetahui dengan tepat jam_kredit
bagi sesuatu subjek .
Sukar untuk mencari rekod di dalam jadual.
Bagaimana Mengatasi masalah kumpulan Yang
Berulang?
Kumpulan yang berulang boleh diatasi dengan
menukarkan Unnormalised Form (UNF) kepada
First Normal Form (1NF). (Seperti jadual di bawah)
Note 1.1:
Problems that occur in tables with repeating groups :
It’s hard to know exactly which Credit_Hour
belongs to which Subject_Name.
To find a record in the table is very difficult.
How to handle Repeating Groups?
The repeating group can be handled by separating
Unnormalised Form (UNF) into First Normal
Form (1NF) as shown later.
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Jadual 1.2: / Table 1.2:
Bentuk Normal Pertama (INF) / First Normal Form (1NF)
STUDENT
Student ID Student
Name
Subject
code
Grade Address Course Coordinator
S0001 Azlina Ahmad ACT410 A Sentul Diploma in Information
Technology
Fazilah
S0001 Azlina Ahmad ADM101 B Sentul Diploma in Information
Technology
Fazilah
S0001 Azlina Ahmad ART210 C Sentul Diploma in Information
Technology
Fazilah
S0144 Amirul
Hamdan
ART310 A Shah Alam Diploma in Computer
Graphic Design
Ahmad
S0144 Amirul
Hamdan
ART230 B Shah Alam Diploma in Computer
Graphic Design
Ahmad
S0144 Amirul
Hamdan
BUS210 B Shah Alam Diploma in Computer
Graphic Design
Ahmad
S0151 Mazlina
Yakub
ART410 C Shah Alam Associate Diploma in
Interactive Multimedia
Sahada
S0151 Mazlina
Yakub
ART 210 A Shah Alam Associate Diploma in
Interactive Multimedia
Sahada
S0151 Mazlina
Yakub
BUS210 A Shah Alam Associate Diploma in
Interactive Multimedia
Sahada
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
+
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
Alam
Diploma in Computer Graphic Design Ahmad
S0151 Mazlina Yakub Shah
Alam
Associate Diploma in Interactive
Multimedia
Sahada
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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.
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
Kesandaran Transitif / Transitive Dependencies
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
Student_ID Student_name, Address, Course
Course Coordinator
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
2 tables (relation) are created
Transitive Dependencies
Hasil /
Akan membentuk 2 relations
Kesandaran transitif /
Becomes
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Contoh 2 :
Langkah-Langkah Penormalan
Example 2 :
Jadual dengan kumpulan data yang berulang (Unnormalised Form (UNF))
(rujuk jadual 2.1)
Bentuk Normal Pertama (First normal Form (1NF)) (rujuk jadual 2.2)
Bentuk Normal Kedua (Second Normal Form (2NF)) (rujuk jadual 2.3)
Bentuk Normal Ketiga (Third Normal Form (3NF)) (rujuk jadual 2.4)
Hapuskan kumpulan data yang berulang
(rujuk Nota 2.1)
Kenal pasti Kesandaran Fungsian. (rujuk Nota 2.2)
Hapuskan Kesandaran Transitif
(rujuk nota 2.3)
Table with repeating groups /
Unnormalised Form (UNF).
(refer table 2.1)
First normal form (1NF)
(refer table 2.2)
Second Normal Form (2NF)
(refer table 2.3)
Third Normal Form (3NF)
(refer table 2.4)
Remove repeating groups
(refer Note 2.1)
Identify Functional Dependencies.
(refer Note 2.2)
Remove Transitive Dependencies
(refer note 2.3)
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Jadual 2.1 / Table 2.1 :
Jadual Unnormalised (UNF) / Unnormalised Table (UNF)
INVOICE
Customers
no
Customer
name
Address Item
code
Item
desc
Qty Price Supplier Supplier
_Address
A100 Abu Sentul
KB100
CP200
MS112
Keyboard
CPU
Mouse
20
10
2
25
650
15
XYZ Ent
XYZ Ent
XYZ Ent.
Petaling Jaya
Petaling Jaya
Petaling Jaya
A101 Salmah Ampang HD200
KB100
SP360
Hard Disk
Keyboard
Speaker
10
10
5
100
25
45
Seagate
XYZ Ent
XYZ Ent
Pulau Pinang
Petaling Jaya
Petaling Jaya
102 Rani Ampang MS112
CP200
VG400
Mouse
CPU
VGA Card
4
2
2
15
650
200
XYZ Ent
XYZ Ent
XYZ Ent
Petaling Jaya
Petaling Jaya
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:
Masalah yang berlaku di dalam jadual yang
mempunyai nilai berulang:
Susah untuk mengetahui dengan tepat
Item_Code bagi Item_Desc tertentu.
Susah untuk mencari rekod di dalam jadual.
Bagaimana untuk Mengatasi Masalah Kumpulan
Data Berulang?
Masalah Kumpulan data berulang boleh di
atasi dengan menukarkan Unnormalised Form
(UNF) kepada First Normal Form (1NF).
(Seperti jadual di bawah)
Note 2.1:
Problems that occur in table with repeating groups
:
It’s hard to know exactly which Item_Code
belongs to which Item_Desc.
To find a record in the table is very difficult.
How to handle Repeating Groups?
The repeating group can be handled by
separating Unnormalised Form (UNF) into
First Normal Form (1NF) as shown later.
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
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
Transitive Dependencies Kesandaran transitif /
Transitive Dependencies Kesandaran transitif /
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
Item_code Item_desc, Price,Supplier
Supplier Supplier_address
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
Hasil /
Transitive Dependencies
/ 2 table (relation)
are created
Kesandaran transitif /
Becomes
Akan membentuk 2 relations
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Contoh 3:
Langkah-Langkah Penormalan
Example 3 :
The Steps in Normalisation
Jadual dengan kumpulan data yang berulang (Unnormalised Form (UNF)).
(rujuk jadual 3.1)
Bentuk Normal Pertama (First normal Form (1NF)) (rujuk jadual 3.2)
Bentuk Normal Kedua (Second Normal Form (2NF)) (rujuk jadual 3.3)
Bentuk Normal Ketiga (Third Normal Form (3NF)) (rujuk jadual 3.4)
Hapuskan kumpulan data yang berulang .
(rujuk Nota 3.1)
Kenal pasti Kesandaran Fungsian.
(rujuk Nota 3.2)
Hapuskan Kesandaran Transitif (rujuk nota 3.3)
Table with repeating groups (UNF)
(refer table 3.1)
First normal form (1NF)
(refer table 3.2)
Second normal form (2NF)
(refer table 3.3)
Third normal form (3NF)
(refer table 3.4)
Remove repeating groups
(refer note 3.1)
Identify Functional Dependencies
(refer note 3.2)
Remove Transitive Dependencies
(refer note 3.3)
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
00500
00444
Samat
Ali
Azie
Elect.Engineer
Web Developer
Web Developer
RM 20
RM 22
RM 22
20
18
15
2 Programming 00123
00999
Kamal
Hazlim
System Analyst
Technical Support
RM 25
RM 16
30
56
3 Multimedia 00689
00111
Samat
Anaz
Elect.Engineer
Programmer
RM 20
RM 18
40
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:
Masalah yang berlaku di dalam jadual yang
mempunyai kumpulan (nilai ) berulang :
Sukar untuk mengetahui dengan tepat
charge_hour bagi pekerja.
Sukar untuk mencari rekod di dalam jadual.
Bagaimana untuk Mengatasi Masalah Kumpulan
Data Berulang?
Masalah Kumpulan data berulang boleh di atasi
dengan menukarkan Unnormalised Form (UNF)
kepada First Normal Form (1NF). (Seperti jadual di
bawah).
Note 3.1:
Problems that occur in tables with repeating
groups :
It’s hard to know exactly which Staff_no
belongs to which Staff_name.
To find a record in the table is very difficult.
How to handle Repeating Groups?
The repeating groups can be handled by
separating Unnormalised Form (UNF) into First
Normal Form (1NF) as shown later.
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Jadual 3.2 / Table 3.2
Bentuk Normal Pertama (1NF) / First Normal Form (1NF)
PROJECT
Project_no Project_
name
Staff_no Staff_name Job_
classification
Charge_
hour
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
Support
RM 16 56
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
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
Transitive Dependencies
Transitive Dependencies
Kesandaran transitif /
Kesandaran transitif /
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
Staff_no Staff_name, Job_classification
Job_classification Charge_hour
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
Becomes
Transitive Dependencies
2 tables
(relation) are
created
Kesandaran transitif /
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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
102
SPSS
Surveys
19 Jul 2003
10 Aug 2003
140 Alan Beeton Accounting 52000 103 Tax Acc 8 Dec 2003
110 Chris Lucera
Info Systems 43000 101
104
SPSS
C++
1 Dec 2003
14 Nov 2003
190 Lorenzo Davis Finance 55000
150 Susan Martin
Marketing 42000 101
105
SPSS
Java
16 Jun 2003
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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.
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:
NZ SDN. BHD
RECEIPT OF HOUSE RENTAL PAYMENT
TENANT’S NAME : Nurul Atiqah TENANT’S CODE: 123
House_code Address Start_
date
End_date Rental Landlord_
code
Landlord
_name
PG 3 No. 6
Taman
Tenaga,
Kajang
1/7/1995 31/7/1997 RM 600 T0069 Intan bt.
Jaafar
PG 14 No. 5
Taman
Cahaya,
Cheras
1/8/1997 1/8/1999 RM 650 T8881 Noor bt.
Nazri
Relation Name (Primary Key, Non-key Attributes)
Nama_relation (Kunci Primer, Atribut Bukan Kunci)
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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)
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)
Kesandaran fungsian / Functional dependencies
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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)
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)
Kesandaran transitive / Transitive dependency
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Contoh 6 / Example 6 :
Normalkan borang di bawah sehingga ke tahap penormalan ke tiga (3NF). /Normalise the following form to Third
Normal Form (3NF).
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:
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
Foundations
Kendall, J DESC A
MIS 420 Human Factors
in IS
Kendall, J DESC B
CIS 412 Database Design Sibley, E CIS A
DESC 353 Management
Models
Kelly, D DESC A
Relation Name (Primary Key, Non-key Attributes)
Nama_relation (Kunci Primer, Atribut Bukan Kunci)
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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)
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)
Kesandaran fungsian / Functional dependency
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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)
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)
Kesandaran transitive / Transitive dependency
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
Contoh 7 / Example 7 :
Normalkan borang di bawah sehingga ke tahap penormalan ke tiga (3NF). /Normalise the following form to Third
Normal Form (3NF).
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:
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
Relation Name (Primary Key, Non-key Attributes)
Nama_relation (Kunci Primer, Atribut Bukan Kunci)
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 )
Skema Hubungan 2NF / Relation Scheme in 2NF:
INVOICE (InvoiceNo, Date, CustomerNo, Name, Address, TelNo)
PRODUCT (ProductCode, ProductName, PriceUnit )
ORDER (InvoiceNo, ProductCode, Quantity, Discount, Subtotal )
Kesandaran fungsian / Functional dependency
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
d) Bentuk Normal Ketiga (3NF) / Third Normal Form (3NF)
Kenal pasti Kesandaran Transitif / Identify Transitive Dependencies
INVOICE (InvoiceNo, Date, CustomerNo, Name, Address, TelNo)
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)
Kesandaran transitif /
Transitive dependency
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
RINGKASAN BAB 3 : PENORMALAN
Langkah-langkah penormalan :
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.
Bentuk Normal Kedua (BN2) (Second
Normal Form (2NF))
Bentuk Normal Ketiga (BN3)
(Third Normal Form (3NF))
Hapuskan kumpulan data yang berulang
Kenal pasti Kesandaran Fungsian
Hapuskan kesandaran Transitif
Jadual Dengan Kumpulan Data Yang
Berulang
Unnormalised Form
Bentuk Normal Pertama (BN1) (First Normal Form (1NF))
© Prepared by : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
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 : [email protected]
F4109: DATABASE SYSTEM NORMALISATION
SUMMARY FOR CHAPTER 3 : NORMALIZATION
Steps in normalization :
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.
Table with repeating groups
(Unnormalised Form (UNF))
First normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
Remove repeating groups
Identify Functional
Dependencies
Remove Transitive
Dependencies