Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

(http://www.studytonight.

com/)

DATABASE TECHNOLOGY

SEETHEINDEX

Normalization of Database
DatabaseNormalisationisatechniqueoforganizingthedatainthedatabase.Normalizationisasystematicapproachofdecomposingtablestoeliminate
dataredundancyandundesirablecharacteristicslikeInsertion,UpdateandDeletionAnamolies.Itisamultistepprocessthatputsdataintotabularformby
removingduplicateddatafromtherelationtables.

Normalizationisusedformainlytwopurpose,

Eliminatingreduntant(useless)data.

Ensuringdatadependenciesmakesensei.edataislogicallystored.

Problem Without Normalization

WithoutNormalization,itbecomesdifficulttohandleandupdatethedatabase,withoutfacingdataloss.Insertion,UpdationandDeletionAnamoliesarevery
frequentifDatabaseisnotNormalized.TounderstandtheseanomaliesletustakeanexampleofStudenttable.

S_id S_Name S_Address Subject_opted

401 Adam Noida Bio

402 Alex Panipat Maths

403 Stuart Jammu Maths

404 Adam Noida Physics

UpdationAnamoly:Toupdateaddressofastudentwhooccurstwiceormorethantwiceinatable,wewillhavetoupdateS_Addresscolumninall

therows,elsedatawillbecomeinconsistent.

InsertionAnamoly:Supposeforanewadmission,wehaveaStudentid(S_id),nameandaddressofastudentbutifstudenthasnotoptedforany

subjectsyetthenwehavetoinsertNULLthere,leadingtoInsertionAnamoly.

DeletionAnamoly:If(S_id)401hasonlyonesubjectandtemporarilyhedropsit,whenwedeletethatrow,entirestudentrecordwillbedeletedalong

withit.

Normalization Rule

Normalizationrulearedividedintofollowingnormalform.

1.FirstNormalForm

2.SecondNormalForm

3.ThirdNormalForm

4.BCNF

First Normal Form (1NF)


AsperFirstNormalForm,notwoRowsofdatamustcontainrepeatinggroupofinformationi.eeachsetofcolumnmusthaveauniquevalue,suchthat
multiplecolumnscannotbeusedtofetchthesamerow.Eachtableshouldbeorganizedintorows,andeachrowshouldhaveaprimarykeythat
distinguishesitasunique.

ThePrimarykeyisusuallyasinglecolumn,butsometimesmorethanonecolumncanbecombinedtocreateasingleprimarykey.Forexampleconsidera
tablewhichisnotinFirstnormalform

StudentTable:

Student Age Subject

Adam 15 Biology,Maths

Alex 14 Maths

Stuart 17 Maths

InFirstNormalForm,anyrowmustnothaveacolumninwhichmorethanonevalueissaved,likeseparatedwithcommas.Ratherthanthat,wemust
separatesuchdataintomultiplerows.

StudentTablefollowing1NFwillbe:

Student Age Subject

Adam 15 Biology

Adam 15 Maths

Alex 14 Maths

Stuart 17 Maths

UsingtheFirstNormalForm,dataredundancyincreases,astherewillbemanycolumnswithsamedatainmultiplerowsbuteachrowasawholewillbe
unique.

Second Normal Form (2NF)

AspertheSecondNormalFormtheremustnotbeanypartialdependencyofanycolumnonprimarykey.Itmeansthatforatablethathasconcatenated
primarykey,eachcolumninthetablethatisnotpartoftheprimarykeymustdependupontheentireconcatenatedkeyforitsexistence.Ifanycolumn
dependsonlyononepartoftheconcatenatedkey,thenthetablefailsSecondnormalform.

InexampleofFirstNormalFormtherearetworowsforAdam,toincludemultiplesubjectsthathehasoptedfor.Whilethisissearchable,andfollowsFirst
normalform,itisaninefficientuseofspace.AlsointheaboveTableinFirstNormalForm,whilethecandidatekeyis{Student,Subject},AgeofStudent
onlydependsonStudentcolumn,whichisincorrectasperSecondNormalForm.Toachievesecondnormalform,itwouldbehelpfultosplitoutthesubjects
intoanindependenttable,andmatchthemupusingthestudentnamesasforeignkeys.

NewStudentTablefollowing2NFwillbe:

Student Age

Adam 15

Alex 14

Stuart 17

InStudentTablethecandidatekeywillbeStudentcolumn,becauseallothercolumni.eAgeisdependentonit.

NewSubjectTableintroducedfor2NFwillbe:

Student Subject

Adam Biology

Adam Maths

Alex Maths

Stuart Maths
InSubjectTablethecandidatekeywillbe{Student,Subject}column.Now,boththeabovetablesqualifiesforSecondNormalFormandwillneversuffer
fromUpdateAnomalies.AlthoughthereareafewcomplexcasesinwhichtableinSecondNormalFormsuffersUpdateAnomalies,andtohandlethose
scenariosThirdNormalFormisthere.

Third Normal Form (3NF)

ThirdNormalformappliesthateverynonprimeattributeoftablemustbedependentonprimarykey,orwecansaythat,thereshouldnotbethecasethat
anonprimeattributeisdeterminedbyanothernonprimeattribute.Sothistransitivefunctionaldependencyshouldberemovedfromthetableandalsothe
tablemustbeinSecondNormalform.Forexample,consideratablewithfollowingfields.

Student_DetailTable:

Student_id Student_name DOB Street city State Zip

InthistableStudent_idisPrimarykey,butstreet,cityandstatedependsuponZip.Thedependencybetweenzipandotherfieldsiscalledtransitive
dependency.Hencetoapply3NF,weneedtomovethestreet,cityandstatetonewtable,withZipasprimarykey.

NewStudent_DetailTable:

Student_id Student_name DOB Zip

AddressTable:

Zip Street city state

Theadvantageofremovingtranstivedependencyis,

Amountofdataduplicationisreduced.

Dataintegrityachieved.

Boyce and Codd Normal Form (BCNF)

BoyceandCoddNormalFormisahigherversionoftheThirdNormalform.Thisformdealswithcertaintypeofanamolythatisnothandledby3NF.A3NF
tablewhichdoesnothavemultipleoverlappingcandidatekeysissaidtobeinBCNF.ForatabletobeinBCNF,followingconditionsmustbesatisfied:

Rmustbein3rdNormalForm

and,foreachfunctionaldependency(X>Y),XshouldbeasuperKey.

Prev(databasekey.php) Next(erdiagram.php)

You might also like