Normalization Exercises A337. 2 Normalization Example 1

  • Published on
    31-Dec-2015

  • View
    225

  • Download
    8

Embed Size (px)

Transcript

  • Normalization ExercisesA337

  • *Normalization Example 1

    Soft

    SOFTWARE

    PACKIDTAGNUMCOMPIDINSTDATESOFTCOSTEMPNUMEMPNAMELOCATION

    AC0132808M5799/12/91754.95611Dinh, MelissaAccounting

    DB3232808M57912/12/91380.00611Dinh, MelissaAccounting

    37691B1216/14/91380.00124Alvarez, RamonSales

    DB3357772C0075/26/91412.77567Feinstein, BettyInfo Systems

    WP0837691B1216/14/91227.50124Alvarez, RamonSales

    57772C0075/26/91170.24567Feinstein, BettyInfo Systems

    WP0959836B22110/29/9135.00124Alvarez, RamonHome

    77740M5795/26/9135.00567Feinstein, BettyHome

    Soft-1NF

    SOFTWARE

    PACKIDTAGNUMCOMPIDINSTDATESOFTCOSTEMPNUMEMPNAMELOCATION

    AC0132808M5799/12/91754.95611Dinh, MelissaAccounting

    DB3232808M57912/12/91380.00611Dinh, MelissaAccounting

    DB3237691B1216/14/91380.00124Alvarez, RamonSales

    DB3357772C0075/26/91412.77567Feinstein, BettyInfo Systems

    WP0837691B1216/14/91227.50124Alvarez, RamonSales

    WP0857772C0075/26/91170.24567Feinstein, BettyInfo Systems

    WP0959836B22110/29/9135.00124Alvarez, RamonHome

    WP0977740M5795/26/9135.00567Feinstein, BettyHome

    Primary Key

    Soft-2NF

    ID_TAGCPTR

    PACKIDTAGNUMINSTDATESOFTCOSTTAGNUMCOMPIDEMPNUMEMPNAMELOCATION

    AC01328089/12/91754.9532808M579611Dinh, MelissaAccounting

    DB323280812/12/91380.0037691B121124Alvarez, RamonSales

    DB32376916/14/91380.0057772C007567Feinstein, BettyInfo Systems

    DB33577725/26/91412.7759836B221124Alvarez, RamonHome

    WP08376916/14/91227.5077740M579567Feinstein, BettyHome

    WP08577725/26/91170.24

    WP095983610/29/9135.00

    WP09777405/26/9135.00

    Soft-3NF

    ID_TAGTAGNOEMPLOYEE

    PACKIDTAGNUMINSTDATESOFTCOSTTAGNUMCOMPIDEMPNUMLOCATIONEMPNUMEMPNAME

    AC01328089/12/91754.9532808M579611Accounting124Alvarez, Ramon

    DB323280812/12/91380.0037691B121124Sales567Feinstein, Betty

    DB32376916/14/91380.0057772C007567Info Systems611Dinh, Melissa

    DB33577725/26/91412.7759836B221124Home

    WP08376916/14/91227.5077740M579567Home

    WP08577725/26/91170.24

    WP095983610/29/9135.00

    WP09777405/26/9135.00

    Parking

    PARKING TICKETS

    SSNLAST_NAMEFIRST_NAMEPHONE_NOLIC_PLATE_STLIC_PLATE_NOTICKET_NODATECODEFINE

    123-34-5678CurryDorothy(916)358-4448CA123 MCD1015110/14/94A$10

    1015210/15/94B$20

    1012111/11/94B$20

    134-56-7783FongMay(916)563-7865CA253 DAL1023110/22/94C$50

    1205112/4/94A$10

    Parking 1NF

    PARKING TICKETS

    TICKET_NOSSNLAST_NAMEFIRST_NAMEPHONE_NOLIC_PLATE_STLIC_PLATE_NODATECODEFINE

    10151123-34-5678CurryDorothy(916)358-4448CA123 MCD10/14/94A$10

    10152123-34-5678CurryDorothy(916)358-4448CA123 MCD10/15/94B$20

    10121123-34-5678CurryDorothy(916)358-4448CA123 MCD11/11/94B$20

    10231134-56-7783FongMay(916)563-7865CA253 DAL10/22/94C$50

    12051134-56-7783FongMay(916)563-7865CA253 DAL12/4/94A$10

    Primary Key

    Parking 2NF

    PARKING TICKETSREGISTRATION

    TICKET_NOSSNDATECODEFINESSNLAST_NAMEFIRST_NAMEPHONE_NOLIC_PLATE_STLIC_PLATE_NO

    10151123-34-567810/14/94A$10123-34-5678CurryDorothy(916)358-4448CA123 MCD

    10152123-34-567810/15/94B$20134-56-7783FongMay(916)563-7865CA253 DAL

    10121123-34-567811/11/94B$20

    10231134-56-778310/22/94C$50

    12051134-56-778312/4/94A$10

    Parking 3NF

    PARKING TICKETSREGISTRATIONFINES

    TICKET_NOSSNDATECODESSNLAST_NAMEFIRST_NAMEPHONE_NOLIC_PLATE_STLIC_PLATE_NOCODEFINE

    10151123-34-567810/14/94A123-34-5678CurryDorothy(916)358-4448CA123 MCDA$10

    10152123-34-567810/15/94B134-56-7783FongMay(916)563-7865CA253 DALB$20

    10121123-34-567811/11/94BB$20

    10231134-56-778310/22/94CC$50

    12051134-56-778312/4/94AA$10

  • *1st Normal Form

    Soft

    SOFTWARE

    PACKIDTAGNUMCOMPIDINSTDATESOFTCOSTEMPNUMEMPNAMELOCATION

    AC0132808M5799/12/91754.95611Dinh, MelissaAccounting

    DB3232808M57912/12/91380.00611Dinh, MelissaAccounting

    37691B1216/14/91380.00124Alvarez, RamonSales

    DB3357772C0075/26/91412.77567Feinstein, BettyInfo Systems

    WP0837691B1216/14/91227.50124Alvarez, RamonSales

    57772C0075/26/91170.24567Feinstein, BettyInfo Systems

    WP0959836B22110/29/9135.00124Alvarez, RamonHome

    77740M5795/26/9135.00567Feinstein, BettyHome

    Soft-1NF

    SOFTWARE

    PACKIDTAGNUMCOMPIDINSTDATESOFTCOSTEMPNUMEMPNAMELOCATION

    AC0132808M5799/12/91754.95611Dinh, MelissaAccounting

    DB3232808M57912/12/91380.00611Dinh, MelissaAccounting

    DB3237691B1216/14/91380.00124Alvarez, RamonSales

    DB3357772C0075/26/91412.77567Feinstein, BettyInfo Systems

    WP0837691B1216/14/91227.50124Alvarez, RamonSales

    WP0857772C0075/26/91170.24567Feinstein, BettyInfo Systems

    WP0959836B22110/29/9135.00124Alvarez, RamonHome

    WP0977740M5795/26/9135.00567Feinstein, BettyHome

    Primary Key

    Soft-2NF

    ID_TAGCPTR

    PACKIDTAGNUMINSTDATESOFTCOSTTAGNUMCOMPIDEMPNUMEMPNAMELOCATION

    AC01328089/12/91754.9532808M579611Dinh, MelissaAccounting

    DB323280812/12/91380.0037691B121124Alvarez, RamonSales

    DB32376916/14/91380.0057772C007567Feinstein, BettyInfo Systems

    DB33577725/26/91412.7759836B221124Alvarez, RamonHome

    WP08376916/14/91227.5077740M579567Feinstein, BettyHome

    WP08577725/26/91170.24

    WP095983610/29/9135.00

    WP09777405/26/9135.00

    Soft-3NF

    ID_TAGTAGNOEMPLOYEE

    PACKIDTAGNUMINSTDATESOFTCOSTTAGNUMCOMPIDEMPNUMLOCATIONEMPNUMEMPNAME

    AC01328089/12/91754.9532808M579611Accounting124Alvarez, Ramon

    DB323280812/12/91380.0037691B121124Sales567Feinstein, Betty

    DB32376916/14/91380.0057772C007567Info Systems611Dinh, Melissa

    DB33577725/26/91412.7759836B221124Home

    WP08376916/14/91227.5077740M579567Home

    WP08577725/26/91170.24

    WP095983610/29/9135.00

    WP09777405/26/9135.00

    Parking

    PARKING TICKETS

    SSNLAST_NAMEFIRST_NAMEPHONE_NOLIC_PLATE_STLIC_PLATE_NOTICKET_NODATECODEFINE

    123-34-5678CurryDorothy(916)358-4448CA123 MCD1015110/14/94A$10

    1015210/15/94B$20

    1012111/11/94B$20

    134-56-7783FongMay(916)563-7865CA253 DAL1023110/22/94C$50

    1205112/4/94A$10

    Parking 1NF

    PARKING TICKETS

    TICKET_NOSSNLAST_NAMEFIRST_NAMEPHONE_NOLIC_PLATE_STLIC_PLATE_NODATECODEFINE

    10151123-34-5678CurryDorothy(916)358-4448CA123 MCD10/14/94A$10

    10152123-34-5678CurryDorothy(916)358-4448CA123 MCD10/15/94B$20

    10121123-34-5678CurryDorothy(916)358-4448CA123 MCD11/11/94B$20

    10231134-56-7783FongMay(916)563-7865CA253 DAL10/22/94C$50

    12051134-56-7783FongMay(916)563-7865CA253 DAL12/4/94A$10

    Primary Key

    Parking 2NF

    PARKING TICKETSREGISTRATION

    TICKET_NOSSNDATECODEFINESSNLAST_NAMEFIRST_NAMEPHONE_NOLIC_PLATE_STLIC_PLATE_NO

    10151123-34-567810/14/94A$10123-34-5678CurryDorothy(916)358-4448CA123 MCD

    10152123-34-567810/15/94B$20134-56-7783FongMay(916)563-7865CA253 DAL

    10121123-34-567811/11/94B$20

    10231134-56-778310/22/94C$50

    12051134-56-778312/4/94A$10

    Parking 3NF

    PARKING TICKETSREGISTRATIONFINES

    TICKET_NOSSNDATECODESSNLAST_NAMEFIRST_NAMEPHONE_NOLIC_PLATE_STLIC_PLATE_NOCODEFINE

    10151123-34-567810/14/94A123-34-5678CurryDorothy(916)358-4448CA123 MCDA$10

    10152123-34-567810/15/94B134-56-7783FongMay(916)563-7865CA253 DALB$20

    10121123-34-567811/11/94BB$20

    10231134-56-778310/22/94CC$50

    12051134-56-778312/4/94AA$10

  • 2nd Normal FormCreate 3 Tables

    Distribute the remaining AttributesCOMPIDINSTDATESOFTCOSTEMPNUMEMPNAMELOCATION

    PACKIDTAGNUM

    PACKID

    TAGNUM

  • 2nd Normal FormINSTDATE, SOFTCOST

    (none in this example), could be things like package name, version, etc.COMPID, EMPNUM, EMPNAME, LOCATIONBecause the Package table has only one field (PACKID), we really dont need this table

    PACKIDTAGNUM

    PACKID

    TAGNUM

  • 3rd Normal Form

    PACKIDTAGNUM

    PACKID

    TAGNUM

    Soft

    SOFTWARE

    PACKIDTAGNUMCOMPIDINSTDATESOFTCOSTEMPNUMEMPNAMELOCATION

    AC0132808M5799/12/91754.95611Dinh, MelissaAccounting

    DB3232808M57912/12/91380.00611Dinh, MelissaAccounting

    37691B1216/14/91380.00124Alvarez, RamonSales

    DB3357772C0075/26/91412.77567Feinstein, BettyInfo Systems

    WP0837691B1216/14/91227.50124Alvarez, RamonSales

    57772C0075/26/91170.24567Feinstein, BettyInfo Systems

    WP0959836B22110/29/9135.00124Alvarez, RamonHome

    77740M5795/26/9135.00567Feinstein, BettyHome

    Soft-1NF

    SOFTWARE

    PACKIDTAGNUMCOMPIDINSTDATESOFTCOSTEMPNUMEMPNAMELOCATION

    AC0132808M5799/12/91754.95611Dinh, MelissaAccounting

    DB3232808M57912/12/91380.00611Dinh, MelissaAccounting

    DB3237691B1216/14/91380.00124Alvarez, RamonSales

    DB3357772C0075/26/91412.77567Feinstein, BettyInfo Systems

    WP0837691B1216/14/91227.50124Alvarez, RamonSales

    WP0857772C0075/26/91170.24567Feinstein, BettyInfo Systems

    WP0959836B22110/29/9135.00124Alvarez, RamonHome

    WP0977740M5795/26/9135.00567Feinstein, BettyHome

    Primary Key

    Soft-2NF

    ID_TAGCPTR

    PACKIDTAGNUMINSTDATESOFTCOSTTAGNUMCOMPIDEMPNUMEMPNAMELOCATION

    AC01328089/12/91754.9532808M579611Dinh, MelissaAccounting

    DB323280812/12/91380.0037691B121124Alvarez, RamonSales

    DB32376916/14/91380.0057772C007567Feinstein, BettyInfo Systems

    DB33577725/26/91412.7759836B221124Alvarez, RamonHome

    WP08376916/14/91227.5077740M579567Feinstein, BettyHome

    WP08577725/26/91170.24

    WP095983610/29/9135.00

    WP09777405/26/9135.00

    Soft-3NF

    ID_TAGTAGNOEMPLOYEE

    PACKIDTAGNUMINSTDATESOFTCOSTTAGNUMCOMPIDEMPNUMLOCATIONEMPNUMEMPNAME

    AC01328089/12/91754.9532808M579611Accounting124Alvarez, Ramon

    DB323280812/12/91380.0037691B121124Sales567Feinstein, Betty

    DB32376916/14/91380.0057772C007567Info Syst