0% found this document useful (0 votes)
5 views2 pages

Understanding Second Normal Form (2NF)

The document explains the concept of Second Normal Form (2NF) using a simple example of a STUDENT_MARKS table that initially violates 2NF due to partial dependency. It illustrates the transformation into two separate tables, STUDENT and MARKS, to eliminate partial dependencies and achieve 2NF. Key points emphasize the necessity of being in 1NF, removing partial dependencies, and ensuring all non-key attributes depend on the entire primary key to enhance data consistency.

Uploaded by

akashrsa29
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Understanding Second Normal Form (2NF)

The document explains the concept of Second Normal Form (2NF) using a simple example of a STUDENT_MARKS table that initially violates 2NF due to partial dependency. It illustrates the transformation into two separate tables, STUDENT and MARKS, to eliminate partial dependencies and achieve 2NF. Key points emphasize the necessity of being in 1NF, removing partial dependencies, and ensuring all non-key attributes depend on the entire primary key to enhance data consistency.

Uploaded by

akashrsa29
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Second Normal Form (2NF) – Simple Example

Before 2NF (Table in 1NF)


Table Name: STUDENT_MARKS
RollNo StudentName Subject Marks
1 Ravi Maths 85
1 Ravi Science 90
2 Priya Maths 80
2 Priya Science 88

■ Partial Dependency Highlighted:


• Primary Key: (RollNo, Subject)
• Partial Dependency: StudentName depends only on RollNo (not on full key).
→ StudentName is partially dependent → ■ Not in 2NF.

After 2NF (Remove Partial Dependency)

Table 1: STUDENT
RollNo StudentName
1 Ravi
2 Priya

Table 2: MARKS
RollNo Subject Marks
1 Maths 85
1 Science 90
2 Maths 80
2 Science 88

SQL Example
CREATE TABLE STUDENT ( RollNo INT PRIMARY KEY, StudentName VARCHAR(50) ); CREATE
TABLE MARKS ( RollNo INT, Subject VARCHAR(50), Marks INT, PRIMARY KEY (RollNo,
Subject), FOREIGN KEY (RollNo) REFERENCES STUDENT(RollNo) );

Key Points of 2NF (Simple Words)


■ Must be in 1NF.
■ Remove partial dependency (non-key column depends on part of primary key).
■ Each non-key attribute should depend on the whole key.
■ Avoids data repetition and improves data consistency.

You might also like