Top Banner

of 36

Order Normalization Presentation

Apr 03, 2018

Download

Documents

JohnSeifert
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/28/2019 Order Normalization Presentation

    1/36

  • 7/28/2019 Order Normalization Presentation

    2/36

    Un-Normalization Form

    UNF

  • 7/28/2019 Order Normalization Presentation

    3/36

    1. Based on Dr. E. Codds rules, each cell can only hold one and only one

    piece of information.

    2. A table is a UNF (Un-normalized Form) table if some records insidethe table contain multiple values (multiple pieces of information).

    Under such situation, we need to normalize this table and its data.

    3. There are three normalization forms to complete normalization jobs.

  • 7/28/2019 Order Normalization Presentation

    4/36

    First Normalization Form

    1NF

  • 7/28/2019 Order Normalization Presentation

    5/36

    1NF Rules:

    1. The table must be UNF.

    2. Highlight all of the columns that contain multiple data (in red color ).

    3. Fill in blank to make sure each record contain the same number of data

    (in blue color)

    1NF (First Normal Form)

  • 7/28/2019 Order Normalization Presentation

    6/36

    1NF Rules:

    4. Move the highlighted columns (in red color) to a new table.

    1NF ( Continued )

  • 7/28/2019 Order Normalization Presentation

    7/36

    1NF Rules:5. Make a copy of one column from the original table to a new table.

    6. In this case, I would like to choose order# column (all columns are

    related to order# column, so I choose it)

    1NF ( Continued )

  • 7/28/2019 Order Normalization Presentation

    8/36

    1NF Rules:

    7. Highlight and Eliminate repeating records in each table.

    1NF ( Continued )

  • 7/28/2019 Order Normalization Presentation

    9/36

    1NF Rules:

    7. Highlight and Eliminate repeating records in each table.

    1NF ( Continued )

    PS: There is no repeating records for the new

    table.

  • 7/28/2019 Order Normalization Presentation

    10/36

    1NF Rules:

    8. Define a Primary Key column for each table. (Based on DB rules, thePrimary Key column in each table can only hold unique data)

    9. Express the table definition in English (includes table name, column

    name, the PK)

    1NF ( Continued )

    PK

    ORDER( order#, order_dt, cust#, c_name, st)

  • 7/28/2019 Order Normalization Presentation

    11/36

    1NF Rules:

    8. Define a Primary Key column for each table. (Based on DB rules, the

    Primary Key column in each table can only hold unique data)

    9. Express the table definition in English (includes table name, column

    name, the PK)

    1NF ( Continued )

    PK

    ORDER_ITEM( order#, item#, item_name, qty, Price)

    PS: If you could not define a Primary Key for

    a single column, you can consider choosing

    multiple columns; which means, thecombination data of multiple columns must

    be unique.

  • 7/28/2019 Order Normalization Presentation

    12/36

  • 7/28/2019 Order Normalization Presentation

    13/36

    End of

    Second Normalization Form

  • 7/28/2019 Order Normalization Presentation

    14/36

    Second Normalization Form

    2NF

  • 7/28/2019 Order Normalization Presentation

    15/36

    2NF Rules:

    1. The table must be 1NF.

    2. Highlight all of the columns that are not fully dependent on the whole

    Primary Key column.

    orHighlight all of the columns that are partially dependent on the whole

    Primary Key column.

    PS: 2NF only handles tables with multiple columns Primary Key. A table with

    single column Primary key is already in the 2NF.

    2NF (Second Normal Form)

  • 7/28/2019 Order Normalization Presentation

    16/36

    2NF Rules:

    1. The table must be 1NF.

    2. Highlight all of the columns that are not fully dependent on the whole

    Primary Key column.

    orHighlight all of the columns that are partially dependent on the whole

    Primary Key column.

    PS: 2NF only handles tables with multiple columns Primary Key.

    2NF (Continued)

    PK

    ORDER( order#, order_dt, cust#, c_name, st)

    PS: If a table is defined a Primary Key for a

    single column, this table is already in 2NF.

  • 7/28/2019 Order Normalization Presentation

    17/36

    2NF Rules:

    1. The table must be 1NF.2. Highlight all of the non-primary key columns that are not fully dependent

    on the whole Primary Key column (in green color).

    or

    Highlight all of the non-primary key columns that are partially dependent

    on the whole Primary Key column (in green color).

    2NF (Continued)

    PK

    ORDER_ITEM( order#, item#, item_name, qty, Price)

  • 7/28/2019 Order Normalization Presentation

    18/36

    2NF Rules:

    1. The table must be 1NF.

    2. Highlight all of the non-primary key columns that are not fully dependent

    on the whole Primary Key column (in green color).or

    Highlight all of the non-primary key columns that are partially dependent

    on the whole Primary Key column (in green color).

    PS: 2NF only handles tables with multiple columns Primary Key.

    2NF (Continued)PS: If a table is defined a Primary Key for

    multiple columns, you need to apply 2NF

    rules on it.

    1. Check each non-primary key column to

    see if it is fully dependent on the whole

    Primary Key columns.

    2. Item_name column is only dependent

    on item#, so you need to highlight it.

    3. Qty column is fully dependent on the

    whole Primary Key.

    4. Price column is only dependent onitem#, so you need to highlight it.

  • 7/28/2019 Order Normalization Presentation

    19/36

    2NF Rules:3. Move the highlighted columns to a new table.

    4. Make a copy of one column from the old table to a new table. In this

    case, I would like to choose itemr# column (all columns in the new

    table are related to item# column in the old table, so I choose it)

    2NF (Continued)

  • 7/28/2019 Order Normalization Presentation

    20/36

    2NF Rules:3. Move the highlighted columns to a new table.

    4. Make a copy of one column from the old table to a new table. In this

    case, I would like to choose itemr# column (all columns in the new

    table are related to item# column in the old table, so I choose it)

    2NF (Continued)

  • 7/28/2019 Order Normalization Presentation

    21/36

    2NF Rules:5. Highlight and Eliminate repeating records in each table.

    2NF (Continued)

    PK

    ORDER_ITEM( order#, item#, qty)

  • 7/28/2019 Order Normalization Presentation

    22/36

    2NF Rules:5. Highlight and Eliminate repeating records in each table.

    2NF (Continued)

    PK

    ORDER_ITEM( order#, item#, qty)

    PK

    ITEM( item#, item_name, Price)

  • 7/28/2019 Order Normalization Presentation

    23/36

    2NF Rules:6. Define a Primary Key column for the new table. (The Primary Key column

    that you are going to choose can only hold unique data)

    7. Express the table definition in English (includes table name, column

    name, the PK)

    2NF (Continued)

    PK

    ITEM( item#, item_name, Price)

  • 7/28/2019 Order Normalization Presentation

    24/36

    PKORDER_ITEM( order#, item#, qty)

    PK

    ITEM( item#, item_name, Price)

    PK

    ORDER( order#, order_dt, cust#, c_name, st)

  • 7/28/2019 Order Normalization Presentation

    25/36

    End of

    Second Normalization Form

  • 7/28/2019 Order Normalization Presentation

    26/36

    Third Normalization Form

    3NF

  • 7/28/2019 Order Normalization Presentation

    27/36

    PK

    ORDER_ITEM( order#, item#, qty)

    PK

    ITEM( item#, item_name, Price)

    PK

    ORDER( order#, order_dt, cust#, c_name, st)

    3NF Rules:

    1. The table must be 2NF.

    3NF (Third Normal Form)

  • 7/28/2019 Order Normalization Presentation

    28/36

    3NF Rules:

    2. Highlight all of the non-primary key columns that are not solely dependenton the Primary Key column.

    or

    Highlight all of the non-primary key columns that are dependent on Primary

    Key column and other non-primary key columns .

    3NF (continued)

    PS: qty is solely dependent on Primary Key

    column. There is no other non-primary key

    column for qty column to be dependent on.

  • 7/28/2019 Order Normalization Presentation

    29/36

    3NF Rules:

    2. Highlight all of the non-primary key columns that are not solely dependent

    on the Primary Key column.

    orHighlight all of the non-primary key columns that are dependent on Primary

    Key column and other non-primary key columns .

    3NF (continued)

    PS:

    1. item_name non-primary key column is

    solely dependent on item# column. There isno other non-primary key column for

    item_name column to be dependent on.

    2. price column non-primary key is solely

    dependent on item# column. There is no

    other non-primary key column for price

    column to be dependent on.

  • 7/28/2019 Order Normalization Presentation

    30/36

    3NF Rules:

    2. Highlight all of the non-primary key columns that are not solely dependent

    on the Primary Key column.

    or

    Highlight all of the non-primary key columns that are dependent on Primary

    Key column and other non-primary key columns .

    3NF (continued)

    PS:

    1. order_dt non-primary key column is solely dependent on order# column. There is no other

    non-primary key column for order_dt column to be dependent on.

    2. cust# non-primary key column is solely dependent on order# column. There is no other

    non-primary key column for cust# column to be dependent on.

    3. c_name non-primary key column is dependent on order# column. C_name is also

    dependent on cust# non-primary key column. So, you need to highlight c_name column.

    4. st non-primary key column is dependent on order# column. St non-primary key column is

    also dependent on cust# non-primary key column. So, you need to highlight c_name column.

  • 7/28/2019 Order Normalization Presentation

    31/36

    3NF (continued)

    3NF Rules:3. Move the highlighted columns to a new table.

    4. Make a copy of one column from the original table to a new table.In this case, I would like to choose itemr# column (all columns in the new

    table are related to item# column in the old table, so I choose it)

  • 7/28/2019 Order Normalization Presentation

    32/36

    3NF (continued)

    3NF Rules:5. Highlight and Eliminate repeating records in each table.

    PKORDER( order#, order_dt, cust#)

  • 7/28/2019 Order Normalization Presentation

    33/36

    3NF (Continued)

    PK

    CUSTOMER( cust#, c_name, st)

    3NF Rules:6. Define a Primary Key column for the new table. (The Primary Key column

    that you are going to choose can only hold unique data)

    7. Express the table definition in English (includes table name, columnname, the PK)

  • 7/28/2019 Order Normalization Presentation

    34/36

    3NF (Continued)

    PK

    CUSTOMER( cust#, c_name, st)PK

    ORDER( order#, order_dt, cust#)

    PK

    ORDER_ITEM( order#, item#, qty)

    PK

    ITEM( item#, item_name, Price)

  • 7/28/2019 Order Normalization Presentation

    35/36

    End of

    Third Normalization Form

  • 7/28/2019 Order Normalization Presentation

    36/36

    Results of Normalization

    PK

    CUSTOMER( cust#, c_name, st)PK

    ORDER( order#, order_dt, cust#)

    PK

    ORDER_ITEM( order#, item#, qty)

    PK

    ITEM( item#, item_name, Price)