Vous êtes sur la page 1sur 22

F3038

RELATIONAL DATABASE
NORMALISATION
Problems in Relational Data Model

Anomalie
s

Information
Redundancy
Problems in Relational Data Model :
Anomalies

Anomali ●
Errors or inconsistence that may result
when a user attempts to update a table
that contains redundant data
3 types of anomalies ( modification,
es

insert & delete )


Update/Modification Anomalies

The modification
Updat

anomaly occurs
when the record is
updated in the
relation. In this
anomaly, the
e
modification in the
value of specific
attribute requires
modification in all
records in which
that value occurs.
Update/Modification Anomalies
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.

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
Bangi 200 (Graphic and
Multimedia)
S0157 Nurazean Bt. Md. Tmn. Koperasi CITP100 Computer power
Sobri Polis 100 (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
Syed Abdul Razak Computer Graphic
and Design.
Update/Modification Anomalies
The Solution :
Therefore, to avoid this problem, separate the STUDENT_COURSE table as follows :

STUDENT
Student_ID Student_Name Address Course_Code
S0144 Hamizah Mohamed Jln. Kg. Gajah ASDIM
Redzwan
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.
Insert Anomalies

Insert


The insertion anomaly occurs when a new record is inserted in the
relation. In this anomaly, the user cannot insert a fact about an
entity until he has an additional fact about another entity.
Insert Anomalies
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.

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. Sobri Tmn. Koperasi CITP100 Computer power 100
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
Insert Anomalies
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 Jln. Kg. Gajah ASDIM
Redzwan
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. Jalan Puchong DIPCGR
Syed 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.
Delete Anomalies

The deletion anomaly occurs


when a record is deleted from
the relation. In this anomaly,
Delete the deletion of facts about an
entity automatically deleted
the fact of another entity
Delete Anomalies
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.
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)
Delete Anomalies
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.
Problems in Relational Data Model :
Information Redundancy

Information • Duplication of data due to storing the


same data multiple times
Redundancy
Information Redundancy
STUDENT_SUBJECT
Student_ID
Student_Name Address Subject_Code Subject_Name Credit_Hours

S0144 Hamizah Jln. Kg. Gajah ACT410 Computerised 4


Mohamed Accounting
Redzwan
S0149 Amjadi Abd. Bandar Baru ADM101 Internet 4
Mubin 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.
Information Redundancy
The solution : 
Therefore, to avoid this problem, we have to separate the STUDENT_SUBJECT table as follows :

STUDENT
Student_ID
Student_Name Address
S0144 Hamizah Mohamed Redzwan Jln. Kg. Gajah

S0149 Amjadi Abd. Mubin Bandar Baru Bangi

S0157 Nurazean Bt. Md. Sobri Tmn. Koperasi Polis

S0159 Aidil Akmar Hj. Ayob Tmn. Melawati

S0035 Syed Ahmad Rizal B. Syed Jalan Puchong


Abdul Razak
Information Redundancy
STUDENT
Subject_Code Subject_Name Credit_Hours
ACT410 Computerised Accounting 4

ADM101 Internet Publishing 4

ADM301 Project 4

STUDENT_SUBJECT
Student_ID Subject_Code It shows that the subject information
S0144 ACT410 appears only once for each subject in
SUBJECT relation & only the Subject_Code
S0149 ADM101 is repeated in the STUDENT_SUBJECT
S0157 ADM101 relation.
S0159 ADM301
S0035 ADM101
Normalization

A process for assigning attributes


into a table and reduces data
redundancy and helps eliminate
the data anomalies that associated
with poor database design
(un-normalized)
The purposes of normalization
To ensure that the anomalies doesn’t occur

To reduce data or storage redundancy

To ensure easy for record searching/finding


Steps in Normalization

Remove repeating groups Remove transitive dependencies

U 1N 2N 3N
NF F F F
Identify functional dependencies
Functional Dependecies

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
Transitive Dependencies

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 3NF if it is in
2NF and has no transitive
dependencies
Non-primary key attribute
is functionally dependent
on another non-primary
key attribute
THE END

Vous aimerez peut-être aussi