# Second Normal Form (2NF)

> Second normal form (2NF) requires a table to already be in 1NF and to have no partial dependency, meaning every non-key column depends on the entire primary key rather than only part of it. The rule only matters when the primary key is composite; a 1NF table with a single-column primary key is automatically in 2NF.

Canonical: https://devsunite.com/resources/core-subjects/dbms/second-normal-form-2nf
Last updated: 2026-11-22

Subject: DBMS · Category: RDBMS Design · 4 min read

Second Normal Form (2NF) builds directly on First Normal Form and adds one more requirement: every non-key attribute must depend on the *entire* primary key, not just part of it. This rule only becomes relevant when a table has a composite primary key (a key made of more than one column); if a table's primary key is a single column, it's automatically in 2NF as long as it's already in 1NF.

## The rule, precisely

A table is in 2NF if it's already in 1NF, and it has no partial functional dependency: no non-key column depends on only *some* of the columns in a composite primary key.

## A worked example, violation and fix

Consider a table tracking student enrollments, with a composite primary key of `{student_id, course_id}`:

| student_id | course_id | student_name | grade |
|------------|-----------|---------------|-------|
| 1 | 101 | Asha | A |
| 1 | 102 | Asha | B |
| 2 | 101 | Ravi | A |

This table is in 1NF (every cell is atomic), but not in 2NF. Here's why: `grade` genuinely depends on the *whole* key, `{student_id, course_id}` together, since a student's grade varies by course. But `student_name` only depends on `student_id` alone, `course_id` is completely irrelevant to what a student's name is. That's a partial dependency, and it's exactly what 2NF forbids.

This causes real problems: "Asha" is stored redundantly, once per course she's enrolled in, and if her name needs correcting, every single row mentioning her needs to be updated, or it risks drifting inconsistent.

**Fix: split off the part that only depends on part of the key.**

`students`

| student_id | student_name |
|------------|---------------|
| 1 | Asha |
| 2 | Ravi |

`enrollments`

| student_id | course_id | grade |
|------------|-----------|-------|
| 1 | 101 | A |
| 1 | 102 | B |
| 2 | 101 | A |

Now `students` holds `student_name`, which depends fully on its own (now single-column) key, `student_id`. And `enrollments` holds `grade`, which genuinely depends on the full composite key, `{student_id, course_id}`. Neither table has a partial dependency anymore, both are in 2NF.

## A quick sanity check for 2NF

Ask, for every non-key column: "does this genuinely need every column in the primary key to determine its value, or could I figure it out from just part of the key?" If any non-key column only needs part of a composite key, that's the partial dependency 2NF requires you to remove, by pulling that column into its own table keyed on just the part it actually depends on.

## Where this matters in real systems

2NF violations show up constantly in real schemas that use composite keys, especially "linking" or "junction" tables connecting two other entities (like `enrollments` connecting `students` and `courses`). The fix, recognizing that some attribute only cares about half the composite key, and giving it its own table, is one of the most common real refactors applied when cleaning up a schema that grew organically without this discipline from the start.

## What interviewers actually ask about 2NF

- **"What does Second Normal Form require, beyond 1NF?"** No partial dependency: every non-key column must depend on the entire primary key, not just part of it.
- **"When is 2NF automatically satisfied?"** When a table's primary key is a single column (not composite) and it's already in 1NF, there's no way to have a "partial" dependency on a key that isn't made of multiple parts.
- **"Identify the 2NF violation in this table."** A very common practical question: given a table with a composite key, spot which non-key column only depends on part of that key.
- **"How do you fix a partial dependency?"** Split the table so the partially-dependent column moves into a new table keyed on only the part of the original key it actually depends on.

## Key takeaways

- 2NF requires 1NF plus no partial dependency: every non-key column must depend on the whole primary key, not just part of it.
- This rule only matters when a table has a composite (multi-column) primary key.
- A partial dependency causes real redundancy, a value tied to only part of the key gets duplicated across every row sharing that part.
- The fix is splitting the partially-dependent column into its own table, keyed on just the portion of the original key it truly depends on.

## Related

- [Previous: First Normal Form (1NF)](https://devsunite.com/resources/core-subjects/dbms/first-normal-form-1nf)
- [Next: Third Normal Form (3NF)](https://devsunite.com/resources/core-subjects/dbms/third-normal-form-3nf)
- [More in RDBMS Design: Features of a Good Relational Database Design](https://devsunite.com/resources/core-subjects/dbms/features-of-good-design)
- [More in RDBMS Design: Functional Dependencies and Their Types](https://devsunite.com/resources/core-subjects/dbms/functional-dependencies-and-types)
- [More in RDBMS Design: Introduction to Decomposition](https://devsunite.com/resources/core-subjects/dbms/introduction-to-decomposition)
- [More in RDBMS Design: Understanding Normalization](https://devsunite.com/resources/core-subjects/dbms/understand-normalisation)
- [More in RDBMS Design: Boyce-Codd Normal Form (BCNF)](https://devsunite.com/resources/core-subjects/dbms/boyce-codd-normal-form-bcnf)
- [All 174 DBMS interview questions](https://devsunite.com/resources/core-subjects/dbms)
