Database Systems · Normal Forms
Insertion Anomaly
Overview
When a table stores related facts together (such as employee details and department details in one tuple), the same information gets repeated across many tuples.
This redundancy causes anomalies — problems that surface when data is inserted, deleted or updated.
The insertion anomaly is the first of the three anomaly types: inserting a new tuple can introduce contradictory copies of a fact that the database has no way to reject.
Key concepts
- Anomaly: a problem that appears when inserting, deleting or updating data in a badly designed (redundant) table.
- Redundancy: the same information repeated in many places in a table.
- Insertion anomaly: a problem created when a new tuple is inserted into the table.
- Three types of anomalies exist; the insertion anomaly is the first one introduced.
- Cause: the department name is duplicated across every employee tuple of that department instead of being stored once.
- Why it goes unchecked: the database does not know where to check, how many tuples to check, or which of the stored values is the right one.
Nothing in the schema forces the department name to agree with the value already stored for that department id. - Root cause chain: redundancy → inconsistency → anomaly.
How it works
- The table holds employee details together with department details in the same tuple (employee id, employee name, department id, department name, …).
The department name is therefore repeated for every employee belonging to that department. - Existing situation: department id 1 has the department name Computer Science, stored in every tuple of an employee working for department 1.
- A new employee with id 101 is inserted, also working for the same department: department id is written as 1, and the department name should be Computer Science.
- A typing error is made and the department name is entered as ECE instead of Computer Science.
- The insertion goes unchecked — the database accepts it, because it cannot tell how many tuples to check or which stored value is correct.
- Consequence: the same department now has two different names — Computer Science in the old tuples, ECE in the new tuple.
- General lesson: when the same information is kept at many places, it can become inconsistent — one place shows one value, another place shows a different value.
Worked examples
Resulting state after the faulty insertion (department 1 now has two names):
| Emp id | Department id | Department name |
|---|---|---|
| (existing employee) | 1 | Computer Science |
| 101 | 1 | ECE (wrongly typed, still accepted) |
Revision summary
- An anomaly is a problem during insert, delete or update in a redundant table.
- There are three types of anomalies; the insertion anomaly is the first.
- The insertion anomaly arises because the department name is duplicated across all employee tuples of that department.
- The database cannot detect the mistake: it has no way to know how many tuples to check or which value is correct, so the wrong value is accepted.
- The result is the same fact in multiple, contradictory versions — the database becomes inconsistent.
- Root cause to remember: redundancy → inconsistency → anomaly.
Previous-year exam insights
- Insertion anomaly: a fact cannot be recorded unless some other, unrelated fact is also recorded (e.g., a new department cannot be stored until an employee joins it), or insertion forces redundant repetition/nulls.
Asked inUGC NET 2016 - Deletion anomaly: deleting a tuple removes other unrelated facts as a side effect (e.g., deleting the last employee of a department loses the department's information).
Asked inUGC NET 2016 - Update anomaly: the same fact is stored in many tuples, so an update must be applied to all copies; missing one leaves the database inconsistent.
Asked inUGC NET 2016 - Anomalies are removed by decomposition into higher normal forms (2NF removes partial dependency, 3NF/BCNF remove transitive dependency), so each fact is stored once.
- A relation is in 2NF if it is in 1NF and every non-prime attribute is fully functionally dependent on every candidate key (no partial dependency).
- A relation is in 3NF if for every non-trivial FD X→A, X is a superkey or A is prime; BCNF requires X to be a superkey for every non-trivial FD.