What is the difference between 1NF and 2NF?
- 1NF (First Normal Form): Ensures that the table has atomic columns (no
multi-valued or repeating groups) and each row has a unique identifier (Primary Key).
- 2NF (Second Normal Form): The table must be in 1NF and all non-key columns
must depend on the entire primary key (i.e., there should be no partial
dependencies).
Example:
- A table with a composite primary key (e.g., StudentID, CourseID) where non-key
attributes like CourseName only depend on CourseID would violate 2NF because
CourseName is partially dependent on the composite key. You would separate this
into two tables (one for Courses and one for Students).