More General Definitions of 2NF and 3 NF
Second Normal Form (2NF) – General Definition
Definition
A relation schema R is in Second Normal Form (2NF) if:
Every non-prime attribute is fully functionally dependent on every candidate key of R.
Key Concepts
1. Prime Attribute
An attribute that is part of a candidate key.
2. Non-Prime Attribute
An attribute that is not part of any candidate key.
3. Partial Dependency
A partial dependency occurs when a non-key attribute depends only on part of a composite key.
Example:
Here C depends only on A, not the whole key (A,B) → this is partial dependency.
2NF eliminates this problem.
When Do We Check for 2NF?
The 2NF test is needed only if the primary key has multiple attributes.
-
If the primary key has one attribute, the relation automatically satisfies 2NF.
Example from the LOTS Relation
LOTS Relation
Candidate Keys
-
Property_id# -
{County_name, Lot#}
Functional Dependencies
Why LOTS Violates 2NF
Consider candidate key:
But we have:
Here:
-
Tax_rate depends only on County_name
-
But the key is {County_name, Lot#}
So Tax_rate depends on part of the key, not the whole key.
This is a partial dependency, which violates 2NF.
Converting LOTS into 2NF
To remove the partial dependency, we decompose the relation.
Table 1: LOTS1
Dependencies carried here:
Table 2: LOTS2
Dependency:
Now:
-
Tax_rate depends fully on County_name
-
No partial dependency exists.
Therefore both relations are in 2NF.
Important Note from the Example
The dependency:
does not violate 2NF because it is not a partial dependency on a candidate key.
However, it will later cause a 3NF violation (transitive dependency).
Summary
A relation is in Second Normal Form (2NF) if it is in 1NF and every non-prime attribute is fully functionally dependent on the whole candidate key, meaning no partial dependency exists.
General Definition of Third Normal Form (3NF)
Formal Definition
A relation schema R is in Third Normal Form (3NF) if for every non-trivial functional dependency:
one of the following conditions must be true:
-
X is a superkey, or
-
A is a prime attribute (part of some candidate key).
Important Terms
1. Non-trivial Functional Dependency
A dependency X → A is non-trivial if A is not part of X.
Example:
Here B is not in A, so it is non-trivial.
2. Superkey
A superkey is a set of attributes that can uniquely identify a tuple in a relation.
Example:
If StudentID uniquely identifies rows, it is a superkey.
3. Prime Attribute
A prime attribute is any attribute that is part of a candidate key.
Example:
Candidate key:
Prime attributes:
Simple Meaning of 3NF
A table is in 3NF if:
-
Non-key attributes depend only on candidate keys
-
There is no transitive dependency
In simple words:
Non-key attributes must depend only on the key and not on other non-key attributes.
Example from the LOTS Relation
Relation after 2NF
Functional Dependency
Why LOTS1 Violates 3NF
Check the rule:
Here:
Check the conditions:
| Condition | Result |
|---|---|
| Is Area a superkey? | ❌ No |
| Is Price a prime attribute? | ❌ No |
Since both conditions fail, the relation violates 3NF.
This also creates a transitive dependency:
So:
Converting LOTS1 into 3NF
To remove the violation, split the relation.
LOTS1A
Dependency:
LOTS1B
Dependency:
Now both tables satisfy 3NF.
Important Observations
1. 3NF Automatically Ensures 2NF
If a relation satisfies 3NF, it will automatically satisfy 2NF.
So testing for 3NF alone is sufficient.
2. 3NF Removes Two Types of Problems
Condition X must be a superkey prevents:
-
Partial dependency
-
Transitive dependency
Alternative Definition of 3NF
A relation is in 3NF if every non-prime attribute:
-
Is fully functionally dependent on every candidate key.
-
Is non-transitively dependent on every candidate key.
Summary of 3NF Rules
A functional dependency X → A is acceptable in 3NF if:
| Condition | Allowed? |
|---|---|
| X is a superkey | ✅ Yes |
| A is a prime attribute | ✅ Yes |
| X not superkey AND A not prime | ❌ Violates 3NF |
Key Idea to Remember
A relation is in 3NF if:
-
It has no partial dependency
-
It has no transitive dependency
or simply:
Every non-key attribute depends on the key, the whole key, and nothing but the key.
✅ Short Memory Rule
A table is in 3NF if every non-key attribute depends only on the key and not on another non-key attribute.

Comments
Post a Comment