CH_18 Anomalies in DBMS

by Jasleen Chhabra | Updated on 29 September 2024

Anomalies in DBMS: Causes, Types, and Solutions

In a Database Management System (DBMS), anomalies are issues that arise when data is poorly organized or redundant. These problems lead to data inconsistency, making the database unreliable for operations such as updates, insertions, and deletions. Most anomalies are a result of non-normalized data, which introduces redundancy and makes maintaining accurate data challenging.

To better understand anomalies, we will discuss their three primary types—Update Anomaly, Insertion Anomaly, and Deletion Anomaly—along with a practical case study from a manufacturing company.


What Causes Anomalies?

Anomalies are mainly caused by data redundancy, where duplicate data is stored unnecessarily in the database, or when data is not properly normalized into multiple tables. Normalization is the process of structuring data to minimize redundancy and improve data integrity. Without proper normalization, databases are prone to inconsistencies and inaccuracies that can disrupt operations.


Types of Anomalies in DBMS

1. Update Anomaly

An update anomaly occurs when changes to data have to be made in multiple places within the database. This type of anomaly happens when the same information is stored in several rows of a table, resulting in data inconsistencies when only part of the information is updated.

Case Study:

Consider a manufacturing company storing employee information in a table named Employee, which includes the following attributes: emp_id, emp_name, emp_address, and emp_dept.

emp_id         emp_name       emp_address      emp_dept    
101 Rick Delhi D001
101 Rick Delhi D002
123 Maggie Agra D890
166 Glenn Chennai D900
166 Glenn Chennai D004

In this table, employee Rick is associated with two departments (D001 and D002), meaning his details are duplicated across two rows. If Rick’s address changes, it must be updated in both rows. Failure to do so will result in inconsistent data—Rick will appear to have two different addresses, which is incorrect and could cause confusion during queries or reports.


2. Insertion Anomaly

An insertion anomaly arises when the structure of a table prevents the addition of new data. This typically happens when some fields in the table require a value but the necessary information is unavailable or irrelevant at the time of insertion.

Case Study:

Suppose a new employee joins the company and is currently under training. Since they are not yet assigned to any department, their record cannot be inserted into the table if the emp_dept field is not allowed to be null. This creates an insertion anomaly, as there is no way to insert the new employee's details without violating database constraints.

emp_id   emp_name   emp_address   emp_dept  
101 Rick Delhi D001
101 Rick Delhi D002
123 Maggie Agra D890
166 Glenn Chennai D900
166 Glenn Chennai D004

3. Deletion Anomaly

A deletion anomaly occurs when deleting data from a database inadvertently results in the loss of other, critical data that shouldn’t be removed. This usually happens in poorly normalized tables, where different types of information are stored together.

Case Study:

In the same Employee table, suppose the company closes department D890 and needs to delete it from the database. Since Maggie is solely assigned to department D890, deleting this department would also remove her employee record, even though her personal details are still required by the company. This loss of employee information constitutes a deletion anomaly.

emp_id   emp_name   emp_address   emp_dept  
101 Rick Delhi D001
101 Rick Delhi D002
123 Maggie Agra D890
166 Glenn Chennai D900
166 Glenn Chennai D004

Resolving Anomalies with Normalization

To eliminate these anomalies, the database needs to undergo a process called normalization. This involves dividing large tables into smaller, related tables to reduce redundancy and ensure data integrity. Each table should be structured in a way that updates, insertions, and deletions affect only the necessary information without leading to inconsistencies.

In the case study above, normalization could involve creating separate tables for employees and departments, each with its own distinct attributes. Instead of duplicating employee details, we could introduce a new table that links employees to departments via foreign keys, ensuring that data changes are consistently propagated without anomalies.


Conclusion

Anomalies in DBMS pose significant challenges to maintaining a reliable and efficient database. Update, Insertion, and Deletion anomalies are common when databases are not properly normalized, leading to data redundancy and inconsistency. By normalizing the database, these problems can be mitigated, ensuring that the data remains accurate, consistent, and easy to manage.


FAQ

Any Questions?
Look Here.

Related Articles

CH_01 Database Management Systems (DBMS)

CH_02 DBMS Architecture

CH_03 DBMS Data Models

CH_04 Difference between DBMS and RDBMS

CH_05 DBMS Data Schemas and Data Independence

CH_06 Database Languages in DBMS

CH_07 ACID Properties in DBMS

CH_08 ER (Entity-Relationship) Diagrams in DBMS

CH_09 Cardinality in DBMS

CH_10 Keys in DBMS

CH_11 Generalization, Specialization, and Aggregation in DBMS

CH_12 Relational Model in DBMS

CH_13 Operations on Relational Model in DBMS

CH_14 Relational Algebra in DBMS

CH_15 Join Operations in DBMS

CH_16 Integrity Constraints in DBMS

CH_17 Relational Calculus in DBMS

CH_19 Normalization in DBMS

CH_20 Transaction Management in DBMS

CH_21 ACID Properties in DBMS

CH_22 Concurrency Control in DBMS

CH_23 Data Backup and Recovery in DBMS

CH_24 Storage System in DBMS