unit4 normalization

Post on 19-Jun-2015

96 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

F3803 – DATABASE SYSTEM

UNIT 4

RELATIONAL DATABASENORMALIZATION

Relational Data Model

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

What is Relation?

Skema Hubungan

Skema hubungan adalah senarai atribut yang terkandung dalam hubungan tersebut

Format : Nama_relation (Kunci Primer, Atribut Bukan Kunci)

• Nama relation : PUBLISHER• Kunci Primer : Publisher_Code• Atribut Bukan Kunci : Name, City

PUBLISHER (Publisher_Code, Name, City)

prepared by: nurizah@ict.puo.edu.my

• 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)y)

C# and P# is a primary key for CUSTOMER and PRODUCT.While the others is non-primary key.

Problem in Relational Data Model

Information Redundancy

Anomalies

• Anomali Pengemaskinian (Update Anomalies)• Anomali - Ralat yang mungkin berlaku apabila pengguna ingin mengemas

kini jadual (relation / table) yang mengandungi data yang berulang.

(a) 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.

Anomalies

• Errors or inconsistence that may result when a user attempts to update a table that contains redundant data

• 3 types of anomalies ( modification, insert & delete )Anomalies

• Duplication of data due to storing the same data multiple timesInformation

Redundancy

Update/Modification Anomalies

Update

• The modification anomaly occurs when the record is updated in the relation. In this anomaly, the modification in the value of specific attribute requires modification in all records in which that value occurs.

prepared by: nurizah@ict.puo.edu.my

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.

prepared by: nurizah@ict.puo.edu.my

Delete Anomalies

•The deletion anomaly occurs when a record is deleted from the relation. In this anomaly, the deletion of facts about an entity automatically deleted the fact of another entity

Delete

prepared by: nurizah@ict.puo.edu.my

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)

• 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

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

UNF 1NF 2NF 3NF

Remove repeating groups

Identify functional dependencies

Remove transitive dependencies

Func

tiona

l D

epen

denc

ies Functional dependencies describe

relationships between attributes in a relationA relationship between attributes in which one attribute or group of attribute determines the value of another in the same table

Tran

sitiv

e D

epen

denc

ies A Functional dependency between 2 or more

non-key attributesA condition in which an attribute is dependent on another attributes that is not part of the primary keyA relation is in 3NF if it is in 2NF and has no transitive dependenciesNon-primary key attribute is functionally dependent on another non-primary key attribute

top related