Third Normal Form
3NF: must be in 2NF, and no transitive dependencies — non-key columns should depend only on the primary key, not on other non-key columns.
3NF: must be in 2NF, and no transitive dependencies — non-key columns should depend only on the primary key, not on other non-key columns.
-- Violates 3NF: employees table
-- emp_id | name | dept_id | dept_name
-- dept_name depends on dept_id (a non-key column)
-- Fix: separate departments table
CREATE TABLE departments (
id INT PRIMARY KEY,
name VARCHAR(100)
);
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(100),
dept_id INT REFERENCES departments(id)
);
If column B determines column C, and B is not the PK, move C to B's own table.