Second Normal Form (2NF)


What is 2NF?

The second step in Normalization is 2NF.

A table is in 2NF, only if a relation is in 1NF and meet all the rules, and every non-key attribute is fully dependent on primary key.

The Second Normal Form eliminates partial dependencies on primary keys.

Let us see an example −

Example (Table violates 2NF)

<StudentProject>

StudentIDProjectIDStudentNameProjectName
S89P09OliviaGeo Location
S76P07JacobCluster Exploration
S56P03AvaIoT Devices
S92P05AlexandraCloud Deployment

In the above table, we have partial dependency; let us see how −

The prime key attributes are StudentID and ProjectID.

As stated, the non-prime attributes i.e. StudentName and ProjectName should be functionally dependent on part of a candidate key, to be Partial Dependent.

The StudentName can be determined by StudentID, which makes the relation Partial Dependent.

The ProjectName can be determined by ProjectID, which makes the relation Partial Dependent.

Therefore, the <StudentProject> relation violates the 2NF in Normalization and is considered a bad database design.

Example (Table converted to 2NF)

To remove Partial Dependency and violation on 2NF, decompose the above tables −

<StudentInfo>

StudentIDProjectIDStudentName
S89P09Olivia
S76P07Jacob
S56P03Ava
S92P05Alexandra

<ProjectInfo>

ProjectIDProjectName
P09Geo Location
P07Cluster Exploration
P03IoT Devices
P05Cloud Deployment

Now the relation is in 2nd Normal form of Database Normalization

Updated on: 12-Sep-2023

31K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements