5.7.25

Second Normal form

Second Normal Form (2NF)

Definition

A table is in Second Normal Form (2NF) if it is in 1NF and all non-key attributes depend on the entire primary key.

Rules

  • 1NF: The table must be in 1NF.
  • No Partial Dependencies: No non-key attribute should depend on only one part of the primary key.

Benefits

  • Eliminates Partial Dependencies: 2NF eliminates partial dependencies, reducing data redundancy.
  • Improves Data Integrity: 2NF ensures that non-key attributes are dependent on the entire primary key.
  • Simplifies Data Maintenance: 2NF makes data maintenance easier by reducing data redundancy.

Example

Consider a table that stores order information:

Order ID Product ID Product Name Quantity
1 A Product A 2

In this example, Product Name depends only on Product ID, which is a partial dependency. To convert this table to 2NF, we would create separate tables for orders and products:

Order ID Product ID Quantity
1 A 2
Product ID Product Name
A Product A

No comments:

Post a Comment

Difference between File and Folder

10 Differences Between Files and Folders Definition: File: A collection of data or information stored on a computer. ...