Database anomalies are problems that occur in poorly designed databases due to redundancy and inconsistent dependencies. These anomalies can lead to data inconsistency, storage waste, and maintenance difficulties.
An insertion anomaly occurs when we cannot insert certain information into the database without also having to insert irrelevant or unknown information.
| Student_ID | Student_Name | Course_ID | Course_Name | Instructor |
|---|---|---|---|---|
| 101 | Alice Smith | CS101 | Database Systems | Dr. Johnson |
| 102 | Bob Wilson | CS102 | Data Structures | Dr. Brown |
Problem: We cannot add a new course (CS103 - Algorithms, Dr. Davis) until at least one student enrolls in it. Similarly, we cannot add student information without enrollment data.
A deletion anomaly occurs when deleting a row results in the loss of information about other entities that we want to retain in the database.
| Student_ID | Student_Name | Course_ID | Course_Name | Instructor |
|---|---|---|---|---|
| 101 | Alice Smith | CS101 | Database Systems | Dr. Johnson |
| 103 | Carol Davis | CS103 | Algorithms | Dr. Davis |
Problem: If Carol drops out and we delete her record, we lose all information about CS103 course and Dr. Davis, even though the course might still exist and be taught by Dr. Davis.
An update anomaly occurs when updating a single piece of information requires multiple rows to be updated, and failure to update all relevant rows results in data inconsistency.
| Student_ID | Student_Name | Course_ID | Course_Name | Instructor |
|---|---|---|---|---|
| 101 | Alice Smith | CS101 | Database Systems | Dr. Johnson |
| 101 | Alice Smith | CS102 | Data Structures | Dr. Brown |
| 101 | Alice Smith | CS103 | Algorithms | Dr. Davis |
Problem: If Alice Smith changes her name to Alice Johnson, we need to update multiple rows. If we miss updating any row, we'll have inconsistent data where the same student appears with different names.
A Functional Dependency (FD) is a constraint that describes the relationship between attributes in a relation. We say that attribute Y is functionally dependent on attribute X if each value of X is associated with exactly one value of Y.
This means that for any two tuples t1 and t2 in a relation R:
If t1[X] = t2[X], then t1[Y] = t2[Y]
| Emp_ID | Emp_Name | Department | Salary | Manager |
|---|---|---|---|---|
| E001 | John Smith | IT | 75000 | Alice Brown |
| E002 | Jane Doe | HR | 68000 | Bob Wilson |
A functional dependency X → Y is trivial if Y ⊆ X (Y is a subset of X)
A functional dependency X → Y is non-trivial if Y ⊄ X (Y is not a subset of X)
A functional dependency X → Y is completely non-trivial if X ∩ Y = ∅ (X and Y have no common attributes)
Armstrong's axioms provide a sound and complete set of inference rules for functional dependencies:
Given: A → B, B → C, A → D
We can derive: A → C (by transitivity), A → BCD (by union)
A Multivalued Dependency (MVD) X ↠ Y exists in relation R if, for each value of X, there is a set of values of Y that are independent of the values of the remaining attributes in R.
Formal definition: X ↠ Y holds in relation R if whenever two tuples exist in R that agree on X, then we can swap their Y values and the resulting tuples will also be in R.
| Employee | Skill | Language |
|---|---|---|
| John | Java | English |
| John | Java | Spanish |
| John | Python | English |
| John | Python | Spanish |
Multivalued Dependencies:
Problem: This creates redundancy - we need all combinations of skills and languages for each employee.
A Join Dependency (JD) is a constraint that specifies that a relation should be decomposed into multiple relations such that the original relation can be reconstructed by joining these decomposed relations.
A relation R satisfies a join dependency ⋈{R1, R2, ..., Rn} if R = R1 ⋈ R2 ⋈ ... ⋈ Rn, where each Ri is the projection of R onto a subset of attributes.
| Supplier | Part | Project |
|---|---|---|
| S1 | P1 | J1 |
| S1 | P2 | J2 |
| S2 | P1 | J1 |
Possible Join Dependencies:
Meaning: The original relation can be reconstructed by joining the projected relations without loss of information.
Functional Dependencies (FDs)
↓ (Every FD is an MVD)
Multivalued Dependencies (MVDs)
↓ (Every MVD implies a JD)
Join Dependencies (JDs)
All attributes contain atomic values, no repeating groups
In 1NF + no partial dependencies (non-prime attributes fully functionally dependent on PK)
In 2NF + no transitive dependencies
In 3NF + all determinants are candidate keys
In BCNF + no non-trivial MVDs not implied by candidate keys
In 4NF + no non-trivial JDs not implied by candidate keys
The process of removing anomalies by decomposing relations while preserving dependencies.
Higher normal forms (up to 5NF) eliminate more types of anomalies.
For questions or clarifications, please contact:
Dr. Mohsin Dar
mohsin.dar@ddn.upes.ac.in