Code Examples
-- VIOLATES 1NF: courses column stores multiple values
-- student_id | name | courses
-- 1 | Sara | Math, Science, English
-- CORRECT 1NF: separate rows per course
-- student_id | name | course
-- 1 | Sara | Math
-- 1 ...
-- VIOLATES 2NF: student_name depends only on student_id, not course_id
-- (student_id, course_id) → student_name, course_name, grade
-- student_name depends on PART of the composite key
-- FIX: decompose into three tables
-- students(id, student_name...
-- VIOLATES 3NF: zip_code determines city (transitive dependency)
-- order_id → customer_zip → customer_city
-- customer_city depends on zip_code, not order_id
-- FIX: extract zip codes into their own table
-- orders: order_id, customer_id, zip_code
...