Normal Forms

1. 1NF (First Normal Form)

Rule:

πŸ‘‰ A table is in 1NF if:

  1. All values are atomic (single value per cell, no multiple values).
  2. No repeating groups or arrays in a column.

Example (Not in 1NF ❌):

StudentIDNameSubjects
1JohnMath, Science
2AlicePhysics, Chem
  • Problem: Column Subjects has multiple values in one cell.

Fixed Table (In 1NF βœ…):

StudentIDNameSubject
1JohnMath
1JohnScience
2AlicePhysics
2AliceChem

Now β†’ each cell has only one value.


βœ… Super Simple Definition:

πŸ‘‰ 1NF = No repeating groups + Atomic values (one value per cell).


2. 2NF (Second Normal Form)

Step 1: Recall 1NF (First Normal Form)

  • Table must have atomic values (no repeating groups, no multiple values in one cell).
    βœ”οΈ Example (Good 1NF):
StudentIDSubjectMarks
1Math90
1Science85
2Math88

Step 2: What is 2NF?

A table is in 2NF if:

  1. It is already in 1NF βœ…
  2. Every non-key column depends on the whole primary key, not just part of it.

πŸ‘‰ This problem occurs only when you have a composite key (primary key made of 2+ columns).


Step 3: Example (Not in 2NF)

StudentIDSubjectStudentNameMarks
1MathJohn90
1ScienceJohn85
2MathAlice88
  • Here, Primary Key = (StudentID, Subject)
  • Problem ❌: StudentName depends only on StudentID, not on both (StudentID + Subject).
  • This is called partial dependency.

Step 4: Fix it β†’ Convert to 2NF

πŸ‘‰ Split the table into two:

Table 1: Student

StudentIDStudentName
1John
2Alice

Table 2: Marks

StudentIDSubjectMarks
1Math90
1Science85
2Math88

Now βœ… every column depends on the whole primary key.


βœ… Super Simple Definition:

πŸ‘‰ 2NF = 1NF + No partial dependency
(Every non-key column must depend on the whole primary key, not just a part of it).


3. 3NF (Third Normal Form)

Step 1: Recall 2NF

  • Table is in 2NF if there are no partial dependencies (non-key columns depend on the whole primary key).

Step 2: What is 3NF?

A table is in 3NF if:

  1. It is already in 2NF βœ…
  2. No transitive dependency exists.

πŸ‘‰ Transitive dependency means:
Non-key column depends on another non-key column (indirectly depending on the key).


Step 3: Example (Not in 3NF)

StudentIDStudentNameDepartmentIDDepartmentName
1JohnD1Computer Sci
2AliceD2Physics
  • Primary Key = StudentID
  • Problem ❌: DepartmentName depends on DepartmentID, which itself depends on StudentID.
  • So DepartmentName is indirectly dependent on StudentID.
    This is a transitive dependency.

Step 4: Fix it β†’ Convert to 3NF

πŸ‘‰ Break into two tables:

Table 1: Students

StudentIDStudentNameDepartmentID
1JohnD1
2AliceD2

Table 2: Departments

DepartmentIDDepartmentName
D1Computer Sci
D2Physics

Now βœ… all non-key columns depend directly on the primary key only.


βœ… Super Simple Definition:

πŸ‘‰ 3NF = 2NF + No transitive dependency
(Every non-key column must depend only on the primary key, not on other non-key columns).


4. BCNF (Boyce-Codd Normal Form)

Step 1: Recall 3NF

  • A table is in 3NF if it’s in 2NF and has no transitive dependency.
  • But sometimes 3NF still allows problems when there are multiple candidate keys.

Step 2: What is BCNF?

A table is in BCNF if:
πŸ‘‰ For every functional dependency (X β†’ Y), X must be a super key.

In simple words:
βœ… Every determinant (the thing on the left side) must be a key.


Step 3: Example (Not in BCNF)

StudentIDCourseInstructor
1DBMSProf. A
2NetworksProf. B
3DBMSProf. A
  • Candidate Keys: (StudentID, Course) and (Course, Instructor)
  • Functional Dependencies:
    • StudentID + Course β†’ Instructor βœ… (OK, left side is key)
    • Course β†’ Instructor ❌ (Here, Course is not a key, but it determines Instructor).

So table violates BCNF.


Step 4: Fix it β†’ Convert to BCNF

Split into two tables:

Table 1: Course_Instructor

CourseInstructor
DBMSProf. A
NetworksProf. B

Table 2: Student_Course

StudentIDCourse
1DBMS
2Networks
3DBMS

Now βœ… every dependency has a key on the left side.


βœ… Super Simple Definition:

πŸ‘‰ BCNF = Stronger 3NF

  • 3NF removes transitive dependency.
  • BCNF goes further: Every determinant must be a candidate key.

Key Differences:

Normal FormGoalKey Points
1NFEliminate duplicate data, single values per columnUnique rows, atomic values
2NFEliminate partial dependencyNo partial dependency on primary key
3NFEliminate transitive dependencyNo non-key attribute depends on another non-key attribute
BCNFEliminate all functional dependency issuesLeft side of dependency must be a superkey

Quick Tips to Remember:

  1. 1NF: Atomic values (no lists).
  2. 2NF: No partial dependency (whole primary key).
  3. 3NF: No transitive dependency (non-key attributes don’t depend on each other).
  4. BCNF: Every dependency must have a superkey on the left side.

MCQ

1. Which of the following is the primary goal of First Normal Form (1NF)?
A) Remove partial dependencies
B) Eliminate duplicate data and ensure atomic values
C) Remove transitive dependencies
D) Ensure all non-key attributes depend on the primary key

Answer: B) Eliminate duplicate data and ensure atomic values

2. In Second Normal Form (2NF), which of the following must be true?
A) The table must be in 1NF
B) There should be no partial dependency of attributes on the primary key
C) All non-key attributes must depend on the whole primary key
D) Both A and B

Answer: D) Both A and B

3. Which of the following is a characteristic of Third Normal Form (3NF)?
A) Eliminate transitive dependency
B) All non-key attributes should depend on the primary key only
C) The table must be in 2NF
D) All of the above

Answer: D) All of the above

4. What does BCNF (Boyce-Codd Normal Form) eliminate?
A) Partial dependency
B) Transitive dependency
C) All functional dependencies where the left side is not a superkey
D) Both A and B

Answer: C) All functional dependencies where the left side is not a superkey

5. Which of the following conditions must a table satisfy to be in 1NF?
A) No partial dependency
B) No transitive dependency
C) Each column must contain only atomic values
D) Each table must have a composite key

Answer: C) Each column must contain only atomic values

6. If a table has columns StudentID, CourseID, InstructorName, and InstructorPhone where StudentID and CourseID form the primary key, which form of normalization is violated if InstructorPhone depends only on InstructorName?
A) 1NF
B) 2NF
C) 3NF
D) BCNF

Answer: C) 3NF

7. In 2NF, if a table has a composite key, what must be ensured about the non-key attributes?
A) Non-key attributes must depend on only one part of the composite key
B) Non-key attributes must depend on the whole composite key
C) Non-key attributes can be completely independent of the key
D) There should be no non-key attributes in the table

Answer: B) Non-key attributes must depend on the whole composite key

8. A table is in 2NF but not in 3NF if:
A) It contains transitive dependencies
B) It contains partial dependencies
C) It has atomic values in all columns
D) It does not contain any duplicate rows

Answer: A) It contains transitive dependencies

9. Which of the following is true for a table in BCNF?
A) Every non-key attribute depends on the primary key
B) Every determinant is a superkey
C) It must be in 1NF, 2NF, and 3NF
D) Both B and C

Answer: D) Both B and C

10. Which of the following describes a transitive dependency in a database table?
A) A non-key attribute depends on the primary key
B) A non-key attribute depends on another non-key attribute
C) A non-key attribute depends on part of the primary key
D) None of the above

Answer: B) A non-key attribute depends on another non-key attribute

11. Which of the following is the correct order of normal forms?
A) 1NF β†’ 3NF β†’ 2NF β†’ BCNF
B) 1NF β†’ 2NF β†’ 3NF β†’ BCNF
C) BCNF β†’ 2NF β†’ 1NF β†’ 3NF
D) 3NF β†’ 1NF β†’ 2NF β†’ BCNF

Answer: B) 1NF β†’ 2NF β†’ 3NF β†’ BCNF

12. A relation is in 1NF, 2NF, and 3NF but not in BCNF. What could be the possible reason?
A) A non-superkey determines a non-prime attribute
B) A non-prime attribute is dependent on another non-prime attribute
C) A primary key is split across multiple columns
D) All columns are atomic

Answer: A) A non-superkey determines a non-prime attribute

13. What is the key problem with a table that violates 2NF?
A) There are partial dependencies where non-key attributes depend on part of the primary key
B) There are transitive dependencies where non-key attributes depend on other non-key attributes
C) The primary key is too large
D) The table has duplicate rows

Answer: A) There are partial dependencies where non-key attributes depend on part of the primary key

14. Which of the following is a requirement for a table to be in 2NF?
A) The table must be in 1NF
B) All non-key attributes must depend on the whole primary key
C) There must be no transitive dependencies
D) Both A and B

Answer: D) Both A and B

15. Which statement about BCNF is true?
A) BCNF is a stricter version of 3NF
B) BCNF allows transitive dependencies
C) A table in BCNF will always be in 3NF, but not always in 2NF
D) BCNF allows partial dependency

Answer: A) BCNF is a stricter version of 3NF