Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Once a table achieves First Normal Form (1NF), it must be evaluated for Second Normal Form (2NF). Second Normal Form eliminates Partial Functional Dependencies, ensuring that every non-key column depends on the entire primary key, rather than just a portion of it.
In relational database theory, a Functional Dependency (X -> Y) means that the value of attribute X uniquely determines the value of attribute Y.
employee_id (X), you can uniquely determine their email (Y). We write: employee_id -> email.A table is in Second Normal Form (2NF) if and only if:
user_id INT PRIMARY KEY), it is AUTOMATICALLY in 2NF! Partial dependencies can ONLY occur in tables that have a Composite Primary Key (a key composed of two or more columns).Consider a junction table tracking student course enrollments where the Primary Key is the composite pair: (student_id, course_id):
grade: Does grade depend on student_id alone? No (a student has multiple grades). Does it depend on course_id alone? No. It depends on both (student_id, course_id). This is a FULL functional dependency!course_name & instructor_name: Does course_name depend on student_id? NO! It depends ONLY on course_id!course_name depends on only a part of the composite primary key (course_id), this is a Partial Dependency!To achieve 2NF, remove the partially dependent columns and place them into a separate table where course_id serves as the primary key:
id INT PRIMARY KEY to a flawed composite table "fixes" 2NF. While it technically satisfies 2NF syntactically, the underlying semantic redundancy still exists! You must still decompose the tables.(order_id, product_id), which column represents a partial dependency?A -> B mean?Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| First Normal Form (1NF) | Third Normal Form (3NF) & Transitive Dependencies |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.