A project office keeps one sheet per employee: emp_id, ename, dept_id, dname and a repeating list of (proj_id, pname, hours). FDs: emp_id → ename, dept_id; dept_id → dname; proj_id → pname; {emp_id, proj_id} → hours. Normalize to BCNF.
Normalization decomposes badly designed relations to remove redundancy and the insertion, deletion and update anomalies it causes. 1NF demands atomic values, 2NF removes partial dependencies, 3NF transitive ones, and BCNF makes every determinant a superkey — always keeping joins lossless.
Suppose the sample data were stored in one table, emp_dept(emp_id, ename, salary, dept_id, dname, location), with key emp_id. Each department's name and location is repeated for every employee in it — Research/Kochi four times. Such redundancy wastes space, but its real cost is the three anomalies it causes.
| emp_id | ename | salary | dept_id | dname | location |
|---|---|---|---|---|---|
| 101 | Anil | 90000 | 10 | Accounts | Thrissur |
| 108 | Hari | 22000 | 10 | Accounts | Thrissur |
| 102 | Bindu | 60000 | 20 | Research | Kochi |
| 104 | Divya | 50000 | 20 | Research | Kochi |
| 105 | Eby | 50000 | 20 | Research | Kochi |
| 109 | Indu | 20000 | 20 | Research | Kochi |
| 103 | Charles | 55000 | 30 | Sales | Kozhikode |
The cause is that dname and location depend on dept_id, which is not the key of emp_dept. Normalization is the systematic process — introduced by Codd (1NF in 1970, 2NF and 3NF in 1971) and extended by Boyce and Codd (BCNF, 1974) — of testing relations against normal forms and decomposing them until every determinant is a key, so each fact is stored once.
A relation is in 1NF if the domain of every attribute contains only atomic (indivisible) values and each attribute of a tuple holds a single value from that domain. Repeating groups, multivalued attributes, composite values treated as one field and nested tables are all forbidden. A relation with repeating groups is called unnormalized (not in 1NF).
Example: emp_phone_bad(emp_id, ename, phones) with Bindu's row holding '9447012345, 9846012345' is not in 1NF. Two fixes exist: flatten it to one row per phone (the key becomes {emp_id, phone} and ename is repeated), or — better — move phones to their own table emp_phone(emp_id, phone) and keep emp(emp_id, ename). The second fix is exactly the E-R mapping rule for a multivalued attribute.
Columns such as phone1, phone2, phone3 technically satisfy 1NF (each holds one value) but are a disguised repeating group: queries must check three columns and a fourth phone needs a schema change. Treat them as a design smell.
Y is fully functionally dependent on X if X → Y holds and no proper subset of X determines Y; otherwise the dependency is partial. A relation is in 2NF if it is in 1NF and every non-prime attribute is fully dependent on every candidate key — no non-prime attribute depends on just part of a key.
Partial dependencies need a composite candidate key, so a 1NF relation whose candidate keys are all single attributes is automatically in 2NF. Prime attributes are exempt: a partial dependency of a prime attribute does not violate 2NF.
A dependency X → Z is transitive when X → Y and Y → Z hold, Y is not a superkey and Y does not determine X. Codd's definition: a relation is in 3NF if it is in 2NF and no non-prime attribute is transitively dependent on a candidate key.
The general (Zaniolo) definition is easier to apply in numericals: R is in 3NF if for every non-trivial FD X → A, either X is a superkey or A is a prime attribute. It covers 2NF automatically, because a partial dependency has a non-superkey left side and a non-prime right side.
A relation is in BCNF if for every non-trivial FD X → A, X is a superkey — every determinant is a key. BCNF simply drops 3NF's escape clause 'or A is prime'. The two forms differ only when a relation has several overlapping composite candidate keys.
Redundancy remains: the fact 'Prof. Nair teaches DBMS' is repeated for every student Prof. Nair teaches. Decomposing on the violating FD gives teacher_course(teacher, course) and student_teacher(student, teacher). The split is lossless (the common attribute teacher is a key of teacher_course) but the FD {student, course} → teacher can no longer be checked inside one table — dependency preservation is lost.
Replacing R by R1, …, Rn is a lossless-join (non-additive) decomposition if joining the projections always gives back exactly R. A lossy decomposition does not lose tuples — it gains spurious tuples, false facts that make the original information unrecoverable.
The chase works for any number of relations: build the matrix, repeatedly apply each FD X → Y by equalising the Y columns of rows that agree on X (preferring an a-symbol), and stop when nothing changes. The decomposition is lossless exactly when some row becomes all a-symbols.
A decomposition is dependency preserving if every FD of F can be checked within single relations: (F₁ ∪ F₂ ∪ … ∪ Fₙ)⁺ = F⁺, where Fᵢ is the projection of F⁺ onto Rᵢ. Without it, enforcing a lost FD needs a join on every update. Lossless join is mandatory; dependency preservation is highly desirable.
Example: R(A, B, C, D) with A → B and C → D has the single key AC and is only in 1NF. A → B violates BCNF → R1(A, B) and R2(A, C, D). In R2, C → D violates → R2a(C, D) and R2b(A, C). Final: (A, B), (C, D), (A, C) — lossless and, here, dependency preserving too.
| Relation and FDs | Candidate keys | Deciding FD | Highest NF |
|---|---|---|---|
| R(A, B, C, D): AB → C, B → D | AB | B → D: B ⊂ key, D non-prime (partial) | 1NF |
| R(A, B, C, D): AB → C, C → D | AB | C → D: C not a superkey, D non-prime, C not part of a key (transitive) | 2NF |
| R(A, B, C, D): AB → CD, D → A | AB, BD | D → A: D not a superkey but A is prime | 3NF |
| R(A, B, C, D): A → B, B → C, C → D, D → A | A, B, C, D | Every left side is a key | BCNF |
| R(A, B, C, D, E): A → B, B → C, C → D, D → E | A | B → C transitive; single-attribute key so no partial dependency | 2NF |
Denormalization deliberately merges tables or stores derived values (a total column, a copied dname) to answer frequent queries without joins — common in reporting databases and data warehouses (star schemas). The price is the redundancy normalization removed: more storage, update anomalies, and extra code or triggers to keep copies consistent. Normalize first, then denormalize selectively where measurements show a need.
Try the problem first, then reveal the working one step at a time.
A project office keeps one sheet per employee: emp_id, ename, dept_id, dname and a repeating list of (proj_id, pname, hours). FDs: emp_id → ename, dept_id; dept_id → dname; proj_id → pname; {emp_id, proj_id} → hours. Normalize to BCNF.
Find the highest normal form: (a) R(A, B, C, D, E) with ABC → E, DB → E, CD → A; (b) R(A, B, C, D, E) with A → BC, CD → E, B → D, E → A; (c) R(A, B, C) with A → B, B → C, C → A.
R(A, B, C) has FDs AB → C and C → B. Show that R is in 3NF but not BCNF, decompose it into BCNF, and test the result for lossless join and dependency preservation.
R(A, B, C, D, E) with F = {A → B, B → C, C → D, D → E}. Find the key, the highest normal form, and a BCNF decomposition.
R(A, B, C, D) with F = {AB → C, B → D}. What is the highest normal form? Decompose it into 2NF.
R(A, B, C, D) with F = {A → B, C → D}. Is the decomposition into R1(A, B) and R2(C, D) lossless? What about R1(A, B, C) and R2(C, D)?
Use 3NF synthesis on R(A, B, C, D, E) with F = {AB → C, C → D, D → B, D → E}.
Classify each problem as an insertion, deletion or update anomaly in student_course(roll, sname, course_id, ctitle, faculty): (a) a new course cannot be added until a student enrols; (b) changing a course title requires editing 120 rows; (c) when the last student drops course C9, the record that C9 is taught by Dr. Rao disappears.
12 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.
Modelled on real KPSC questions (reworded) with the same concept and answer; each links to its original paper.