Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Normalization.
The process of organizing data to minimize redundancy while ensuring data integrity is called normalization
Redundanc y
Integrity
8000
ZAIN
ALI
BCSE
Fall 2009 4
123
CA
Fresh
8000
ZAIN
ALI
BCSE
Fall 2008 3
124
OS
Fresh
PF ITC PF ITC PF
3 3 3 3 3
8001
ABDULLAH
RAFAQAT
BCSE
Fall 2008 3
124
OS
Fresh
8002
Musa
HADI
BSTE
Fall 2007 8
125
DS
Fresh
flatten the table and extend the key Or decompose the relation
Flattened table
R( Regno, Name, Fathers Name, Program, Batch, Semester, Repeat/Fresh, Course Code, Subject, Prereqs, Credit hours, Passed)
Flattened table
Regno Name Fathers Name Aa Aa Aa Program Batch Semester Course Subject Repeat/Fresh Prereqs code 4 4 4 123 124 125 CA OS SE Fresh Fresh Fresh Credit Hours Passed 3998 3998 3998 A A A Bcse Bcse Bcse Fall 2009 Fall 2009 Fall 2009 Electronics 3 ISE PF 3 3 Y Y Y
4000
Bb
Bcse
Fall 2009
123
Ca
Fresh
Electronics 3
B B C C c
Bb Bb Cc Cc Cc
Fall 2009 Fall 2009 Fall 2009 Fall 2009 Fall 2009
4 4 4 4 4
Os Se Ca Os Se
ISE ISE
3 3
Y Y Y Y y
Disadvantage
Flattened table does not have repeating groups, but has redundancy.
Redundant data is the main cause of insertion, deletion, and updating anomalies.
Decomposing a Relation
Better approach to decompose a relation. Law to decompose is Put redundant group of attributes in one table and non redundant group of attributes in another table.
CA OS SE CA OS SE
3 3 3 3 3 3
Y Y Y Y Y Y
Decomposing Relation
We have two tables. Biodata( Regno, Name, FatherName, Program, Batch, Semester, Repeat/fresh) Courses(Regno, CourseCode, subject, prereq, credithours, passed) Without repeating groups relations are in First Normal Form
Regno 3998 4000 4003 name A B C Father name Aa Bb Cc Program Bcse Bcse bcse Batch Fall 2009 Fall 2009 Fall 2009 Semester 4th 4th 4th
Regno 1 2
Prereq passed y f
prereqs sc ca
Regno 3998 4000 4003 name A B C Father name Aa Bb Cc Program id 1 1 1 Batch id 1 1 1 Semester 4th 4th 4th Program id 1 2 3 Program name Bcse Bste bba
Batch id 1 2 3
Batch name Fall year 2007 Fall year 2008 Fall year 2009
Regno 1 2 1
Cousecode 123 321
Prereq passed y F y
credithours 3
Pre-reqs code 1 2
Computer archietecture 3
Prereq code 1 2
k n a h T
u o Y