Top Banner

of 24

15856 Normalization

Mar 02, 2018

Download

Documents

Sheeraz Ahmad
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/26/2019 15856 Normalization

    1/24

    NORMALIZATION

  • 7/26/2019 15856 Normalization

    2/24

    Objective of Normalization

    To free relations from undesirableinsertion ,deletion,update anomalies.

    To remove inconsistencies Normalization of data can be dened

    as a process durin! "#ic# redundantrelation sc#emas are decomposed b$

    brea%in! up t#eir attributes into smallerrelation sc#emas t#at possess desirableproperties.

  • 7/26/2019 15856 Normalization

    3/24

    A relation is said to be in particular normalform if it satises a certain specied set ofconstraints.&or '!(

    )N&( eliminate repeatin! !roups

    *N&( Non+%e$ attribute full$ functionaldependence on -

    N&( 'liminate Transitive dependenc$ on

    - /N&( remove Multivalue dependenc$

    0N&( 1oin 2ependenc$

  • 7/26/2019 15856 Normalization

    4/24

    )stNormal &orm

    A relation is said to be in )stnormal formif 3 onl$ if ever$ entr$ of t#e relation #asatmost a sin!le value.

    Faculty Name Course_code

    #aris# 45'6)45')745'06)

    ardeep 45'6*45')745')6)

    RA1 45'/6*45')6)

  • 7/26/2019 15856 Normalization

    5/24

    To ma%e it in )N&,"e #ave to useatomic value(

    Faculy_name Course_code

    8aris#8aris#8aris#

    45'6)45')745'06)

    ardeepardeepardeep

    45'6*45')745')6)

    RajRaj

    45'/6*45')6)

  • 7/26/2019 15856 Normalization

    6/24

    *nd Normal form

    A relation is said to be in *ndNormal formif(

    ).If it in )N&*.All its non+primar$ attributes are full$

    dependent on t#e primar$ %e$.

  • 7/26/2019 15856 Normalization

    7/24

    4onsider relation Lab9course

    Lab_course Teacher Lab_no Lab_capacity

    45'6) ANIL +6) 6

    45'6/ AMIT +6* *:

    45')7 5;MIT +6 *

    45')6) NI-8IL +6/ 6

    45'06) RA8;L +60 *:

  • 7/26/2019 15856 Normalization

    8/24

    &irst nd out all t#e functionaldependencies (

    ). Lab9course Teac#er

    *.Lab9course Lab9no

    .Lab9course

    Lab9capacit$

    ) 3 * dependencies e

  • 7/26/2019 15856 Normalization

    9/24

    To ma%e it in *N&,decompose itinto t"o relations

    Lab9course teac#er

    Lab9course Lab9no

    Lab_course Teacher Lab_no

    45'6) ANIL +6)

    45'6/ AMIT +6*

    45')7 5;MIT +6

    45')6) NI-8IL +6/

    45'06) RA8;L +60

  • 7/26/2019 15856 Normalization

    10/24

    Lab9noLab9capacit$

    Lab_no Lab_capacity

    +6) 6

    +6* *:

    +6 *

    +6/ 6

    +60 *:

    Now these two relations are in 2NF becoz in each

    relation allthe non primary attributes are fully functional onprimary key

  • 7/26/2019 15856 Normalization

    11/24

    rdNormal form

    A relation is in rdnormal form(

    If it is in *N&

    All non+primar$ attributes #ave notransitivit$ dependenc$ on t#e primar$%e$

  • 7/26/2019 15856 Normalization

    12/24

    4onsider student relation(

    rollno Game Fee

    ) 4ric%et *66

    * Tennis 66

    &ootball )66

    / 4ric%et *66

    0 8oc%e$ )06

    This relation is in NFbecoz all its attribute contain ato"lso it is in 2NF becoz all its non#primary key attributefunctional dependent on the primary key $%ollNo&'(ut it is not )NF becoz there is transiti!e dependency'

    %ollno*amefee

  • 7/26/2019 15856 Normalization

    13/24

    5o Anomalies e

  • 7/26/2019 15856 Normalization

    14/24

    =o$ce 4odd Normal form

    =4N& is an improved form of N&.

    A relation is in N& ,if ever$ determinant is acandidate %e$

    A determinant is an attribute on "#ic#ot#er attribute is full$ functional dependent.

    '!(

    Re!istrationNo,sectionNocourse9name

    5ectionNo ,course9I2facult$9name

  • 7/26/2019 15856 Normalization

    15/24

    /t#Normal &orm

    A relation is in /t#N&(

    If it is in rdN& OR =4N&

    If it contains no multi valueddependencies. OR t#ere are multi valuedependencies but t#e attributes "#ic#are multi value dependent on a specic

    attribute are dependent bet"eent#emselves.

    4 id ' l R l ti

  • 7/26/2019 15856 Normalization

    16/24

    4onsider 'mplo$ee Relation(case)(

    ,mp_id Lan*ua*e +kill

    )6) 'n!lis# Teac#in!

    )6) 8indi 5in!in!

    )6) unjabi 4onversation

    *6* 'n!lis# 5in!in!

    *6* 8indi teac#in!

    8ere bot# emplo$ees %no" more t#an one lan!ua!e 3 also #aveMore t#an one s%ill.t#us multivalued dependenc$ eer from an$ anomal$.

  • 7/26/2019 15856 Normalization

    17/24

    relation "it# multi value

    dependencies(

    ,mp_id Lan*ua*e +kill

    )6) 'n!lis# Teac#in!

    )6) 8indi 4onversation

    )6) 'n!lis# 4onversation

    )6) 8indi Teac#in!

    *6* 'n!lis# 5in!in!

    *6* 8indi teac#in!

    8ere bot# emplo$ees %no" more t#an one lan!ua!e 3 also #aveMore t#an one s%ill.t#us multivalued dependenc$ eer5 from 2'L'T' 3 ;2AT' anomal$.

  • 7/26/2019 15856 Normalization

    18/24

    To ma%e it into /N&,decompose itinto t"o smaller tables 3 it "ill

    not su>er from anomal$,mp_lan*ua*e,mp_id lan*ua*e

    )6) 'n!lis#

    )6) 8indi

    *6* 'n!lis#

    *6* #indi

    ,mp_skill,mp_id skill

    )6) Teac#in!

    )6) 4onversation

    *6* 5in!in!

    *6* teac#in!

  • 7/26/2019 15856 Normalization

    19/24

    0t#Normal &orm

    A relation is said to be in 0t#N& if(

    It is in /N&

    It can not be furt#er non+lossdecomposed.

  • 7/26/2019 15856 Normalization

    20/24

    4onsider t#e table

    "*ent Company .roduct_name

    5uneet A=4 N;T

    5uneet A=4 5cre"

    5uneet 42' =olt

    Raj A=4 bolt

    T#is table is in /N& becoz it contains no multi+valued dependebut contain a redundanc$ as 5uneet is a!ent for A=4 t"ice 3t#ere is no "a$ of eliminatin! t#is redundanc$ "it#out inform

  • 7/26/2019 15856 Normalization

    21/24

    2ecomposin! table into p)3p*

    "*ent Company

    5uneet A=4

    5uneet 42'

    Raj A=4

    "G,NT .%/01CT_name

    5uneet Nut

    5uneet 5cre"

    5uneet =olt

    Raj bolt

    No" redundanc$ #as been eliminated but t#e information about "#icMa%e "#ic# products 3 "#ic# of t#ese products t#et suppl$ to "#ic# a#as been lost.

  • 7/26/2019 15856 Normalization

    22/24

    resultant table is as follo"s

    named as A!entNe"(

    "*ent Company .roduct_name

    5uneet A=4 Nut

    5uneet A=4 5cre"

    5uneet A=4 =olt?

    suneet 42' Nut?

    suneet 42' 5cre"?

    suneet 42' bolt

    raj A=4 bolt

    T#e resultin! table after join is spurious as asteris%ed ro" of tacontains incorrect information.

    N id t bl i

  • 7/26/2019 15856 Normalization

    23/24

    No" consider table isdecomposed into parts ),*3

    Company .roduct_name

    A=4 Nut

    A=4 scre"A=4 bolt

    42' bolt

  • 7/26/2019 15856 Normalization

    24/24

    No" perform join on A!entNe" 3

    "*ent Company .roduct_name

    suneet A=4 nut

    suneet A=4 scre"

    suneet A=4 =olt?

    suneet 42' bolt

    raj A=4 bolt

    T#is still contain spurious ro"5o it is not possible to decompose A!ent table "it#out losin! information

    And it #as to be accepted t#at it is not possible to eliminate all redundasin! normalization becoz it can not be assumed t#at all decompositions "i