0% found this document useful (0 votes)
3 views6 pages

Maila

Uploaded by

muqaddasakram416
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Maila

Uploaded by

muqaddasakram416
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

(ASSIGNMENT )

… DISTRIBUTED DATABASE systems …

Department computer science

SUBMITTED TO : SIR SHAHZAD

SUBMITTED BY :
GROUP1 (GIRLS)

MAILA TAHIR

21324/411724

6TH SEM (M)

COURSE CODE : CSI-512

COURSE TITTLE : DISTRIBUTED DATABASE SYSTEMS

CREDIT HOURS : 3(2-1)

TOPIC : NORMALIZATION (Upto 3NF)

SUBMISSION DATE : 27-05-2024 (Monday)


 Normalization :

 The words normalization and normal form refer to the structure of a database.
 Normalization was developed by IBM researcher E.F. Codd in the 1970s.
 Normalization increases clarity in organizing data in Databases
 Normalization is used to minimize the redundancy from a relation or set of
relations. It is also used to eliminate undesirable characteristics like Insertion,
Update, and Deletion Anomalies.
 Normalization divides the larger table into smaller and links them using
relationships.

 Need of normalization ?
 The main reason for normalizing the relations is removing these anomalies.
 Failure to eliminate anomalies leads to data redundancy and can cause data
integrity and other problems as the database grows.
 Normalization consists of a series of guidelines that helps to guide you in
creating a good database structure.
 Normal forms : (first 3 )
 Normalization consist of series, steps or stages called Normal Forms
 It is a state of relation that can be determined by applying simple rules or conditions .
 If relation satisfy the condition of normal forms then the relation is said to be in that
normal form

STAGES ACTIONS

. UN-NORMALIZED RELATION

REMOVE REPEATING GROUPS

FIRST NORMAL FORM

REMOVE PARTIAL DEPENDENCIES

SECOND NORMAL FORM

REMOVE TRANSITIVE DEPENDENCIES

THIRD NORMAL FORM


 Un-normalized relation :

Patient ID Name Address VisitDate Physician Diagnosis Treatmen


t
P-100809 Ali 32-M 12-02-2023 Dr. Zahid Chest Infection Free
Model 20-02-2023 Dr. Farooq Cold Free
Town, 29-02-2023 Dr. Rehan Hepatitis-A Paid
Lahore. 15-03-2023 Dr. Liaqat Eye Infection Free

P-200145 Fatima 9-Jail 10-01-2023 Dr. Ahmad Bone Fracture Paid


Road, 15-02-2023 Dr. Umar Cough Free
Lahore. 25-03-2023 Dr. Ayesha Flu Free

 First normal form :

(no repeating groups)


For a table to be in the first normal form, it must meet the following criteria :

 A single cell must not hold more than one value (atomicity)
 There must be a primary key for identification
 No duplicated rows or columns Each column must have only one value for each row
in the table.

CONVERTING UN-NORMALZED TABLE INTO 1ST NORMAL FORM

Patient ID Name Address VisitDate Physician Diagnosis Treat


ment
P-100809 Ali 32-M Model 12-02-2023 Dr. Zahid Chest Free
Town, Lahore. Infection

P-100809 Ali 32-M Model 20-02-2023 Dr. Farooq Cold Free


Town, Lahore.
P-100809 Ali 32-M Model 29-02-2023 Dr. Rehan Hepatitis-A Paid
Town, Lahore.
P-100809 Ali 32-M Model 15-03-2023 Dr. Liaqat Eye Infection Free
Town, Lahore.
P-200145 Fatima 9-Jail Road, 10-01-2023 Dr. Ahmad Bone Paid
Lahore. Fracture
P-200145 Fatima 9-Jail Road, 15-02-2023 Dr. Umar Cough Free
Lahore.
P-200145 Fatima 9-Jail Road, 25-03-2023 Dr. Ayesha Flu Free
Lahore.
After applying First Normala Form ,Repeating Groups are Eliminated

Suppose Above Relation is named as PATIENT and Primary key of this Relation is Selected
as Combination od PatientID and VisitDate attribues

PATIENT(PatientID,Name,Address,VisitDate,Physician,Diagnosis,Treatment)

 SECOND normal form :


(no partial dependency )
The 1NF only eliminates repeating groups, not redundancy. That’s why there is 2NF.

 A table is said to be in 2NF if it meets the following criteria:


 It’s already in 1NFHas no partial dependency. That is, all non-key attributes are fully
dependent on a primary key.
 Partial Dependency : Dependency in which one or more key attributes are
functionally dependent on part(but not all)of the primary key called partial functional
dependency .

CONVERTING UN-NORMALZED TABLE INTO 2ND NORMAL FORM

Partial Dependency must be removed to convert a Relation inti 2nd Normal Form.
Therefore we Split the Relation into Following 2 Relations as PATIENT2 and
PATIENT HISTORY.

PATIENT2(PatientID,Name,Address)

Patient ID Name Address


P-100809 Ali 32-M Model Town,
Lahore.
P-200145 Fatima 9-Jail Road, Lahore.

PATIENT HISTORY(PatientID,VisitDate,Physician,Diagnosis,Treatment)

Patient ID VisitDate Physician Diagnosis Treatment


P-100809 12-02-2023 Dr. Zahid Chest Infection Free

P-100809 20-02-2023 Dr. Farooq Cold Free

P-100809 29-02-2023 Dr. Rehan Hepatitis-A Paid

P-100809 15-03-2023 Dr. Liaqat Eye Infection Free

P-200145 10-01-2023 Dr. Ahmad Bone Fracture Paid


P-200145 15-02-2023 Dr. Umar Cough Free

P-200145 25-03-2023 Dr. Ayesha Flu Free

In the Relation PATIENT2 ,Primary key id PatientID and all other attributes are Functionally
Dependent on this primary key. Similarly ,in the Relation PATIENT HISTORY, Primary key
is PatientID and VisitDate and all other attributes are Functionally Dependent on this primary
key. Therefore these Relations are in 2NF

 THIRD normal form :


(no transitive dependency)
When a table is in 2NF, it eliminates repeating groups and redundancy, but it does not
eliminate transitive partial dependency.This means a non-prime attribute (an attribute that is
not part of the candidate’s key) is dependent on another non-prime attribute. This is what the
third normal form (3NF) eliminates.

 So, for a table to be in 3NF, it must:Be in 2NF


 Have no transitive partial dependency.

CONVERTING UN-NORMALZED TABLE INTO 3RD NORMAL FORM

PAT-HISTORY(PatientID,VisitDate,Physician,Diagnosis)

Patient ID VisitDate Physician Diagnosis


P-100809 12-02-2023 Dr. Zahid Chest Infection

P-100809 20-02-2023 Dr. Farooq Cold

P-100809 29-02-2023 Dr. Rehan Hepatitis-A

P-100809 15-03-2023 Dr. Liaqat Eye Infection


P-200145 10-01-2023 Dr. Ahmad Bone Fracture

P-200145 15-02-2023 Dr. Umar Cough

P-200145 25-03-2023 Dr. Ayesha Flu


DIAGNOSIS(Diagnosis,Treatment)

Diagnosis Treatment
Chest Infection Free

Cold Free

Hepatitis-A Paid

Eye Infection Free

Bone Fracture Paid

Cough Free

Flu Free

If we see PATIENT HISTORY , it was in 2NF . Obvious that physician and Diagnosis
Attributes are directly dependent on the primary key but the treatment is indirectly dependent
on primary key .

Means that treatment was transitively dependent on “Diagnosis”

Therefore, we Split the Relation into 2 Relation to get the relation in 3NF Suppose these
Relations to be named as PAT-HISTORY and DIAGNOSIS ..

You might also like