You are on page 1of 23

Database Management System.

Project On Registration Form

Normalization.
The process of organizing data to minimize redundancy while ensuring data integrity is called normalization

Redundanc y

Integrity

Simple Data table


R egno N am e Fa th e r s N am e Pro g ra m B a tch S e m e ste r C o u rse S u b j ct R e p e a t/ Fre s P re re q s e co d e h C re d i t H o u rs P a sse d

8000

ZAIN

ALI

BCSE

Fall 2009 4

123

CA

Fresh

Electronic 3 s 3 ISE 3 DBMS

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

First Normal Form


The table must not have repeating groups.

To remove the repeating groups:


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

4000 4000 4003 4003 4003

B B C C c

Bb Bb Cc Cc Cc

Bcse Bcse Bcse Bcse Bcse

Fall 2009 Fall 2009 Fall 2009 Fall 2009 Fall 2009

4 4 4 4 4

124 125 123 124 125

Os Se Ca Os Se

Fresh Fresh Fresh Fresh Fresh

ISE ISE

3 3

Y Y Y Y y

Electronics 3 ISE ISE 3 3

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.

Regno 3998 4000 4003 Regno

Decomposing Relation Diagram


name A B C Coursecode Father name Aa Bb Cc coursetitle Program Bcse Bcse bcse Fresh/repeat Batch Semester 4th 4th 4th Prereq passed Fall 2009 Fall 2009 Fall 2009 Credit hours prereqs

3998 3998 3998 4000 4000 4000

123 124 125 123 124 125

CA OS SE CA OS SE

FRESH FRESH FRESH FRESH FRESH FRESH

3 3 3 3 3 3

ELECTRONICS ISE PF ELECTRONICS ISE PF

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

Second Normal Form

Second Normal Form


There must be no partial key dependencies. There must be no repeating groups, and all non-key attributes must depend on the whole key, not just some part of it.


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

Coursecode coursetitle Credit hours 321 321 qwe fffg 4 4

Pre-reqs code 123

Prereq passed y f

Pre - req code 124 123

prereqs sc ca

Third Normal Form

Third Normal Form


A relation is in 3NF if it contains no repeating groups, no partial functional dependencies, and no transitive functional dependencies


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

Coursecode 321 321 123


Coursetitle Software construction

Prereq passed y F y

credithours 3

Pre-reqs code 1 2

Computer archietecture 3

Prereq code 1 2

prereqs Pf,itc calculus

Attributes & Data Types

Course Detail Select Query


SELECT courseDetail.CourseCode, courseDetail.Coursetitle, courseDetail.credithours, prereqDetail.prereqs, course.prereqpasd FROM prereqDetail INNER JOIN (courseDetail INNER JOIN course ON courseDetail.CourseCode=course.coursecode) ON prereqDetail.prereqcode=courseDetail.prereqco de WHERE (((course.Regno)=[reg]));

Biodata Select Query


SELECT Biodata.Regno, Biodata.Fnme, Biodata.Semester, Batch.BatchNme FROM Batch INNER JOIN Biodata ON Batch.Batchid = Biodata.batchid WHERE (((Biodata.Regno)=[@reg]));

k n a h T

u o Y