Anomaly Examples
Anomaly Examples
Johnson | Marketing
three types of anomalies (insertion, update, and deletion) |
using tables.
|3 | Emily | Project C | Ms. Thompson | Sales
Consider the following denormalized table that stores |
information about employees and their projects:
Here, the update of the project manager's name has to be
Table: EmployeeProjects performed in multiple places, risking inconsistencies if the
update is missed in any of the corresponding records.
Emplo Employee Proj ProjectMa Depart
yeeID Name ect nager ment 3. Deletion Anomaly:
1 John Proj Mr. Smith Sales
ect A A deletion anomaly occurs when deleting data from the table
2 Sarah Proj Ms. Marketi unintentionally removes other related data that should have
ect B Johnson ng been preserved. Let's say we remove the record for "Employee
3 Emily Proj Mr. Adams Sales 3" who was working on "Project C." As a result, the information
ect C about the project and the department is lost:
1. Insertion Anomaly:
| EmployeeID | EmployeeName | Project | ProjectManager
An insertion anomaly occurs when we cannot add data to the | Department |
table without including unnecessary or incomplete
|------------|--------------|--------------|----------------|---------------|
information. In this case, let's say we want to add a new
project, "Project D," to the table, but there is no employee |1 | John | Project A | Mr. Smith | Sales |
assigned to that project yet. We would need to insert a record
|2 | Sarah | Project B | Ms. Johnson | Marketing
with incomplete information:
|
Employe EmployeeNa Proje ProjectMana Departm
eID me ct ger ent The deletion of "Employee 3" results in the loss of information
1 John Proje Mr. Smith Sales about "Project C" and its associated department.
ct A To address these anomalies, the table can be normalized into
2 Sarah Proje Ms. Johnson Marketin separate tables for Employees, Projects, and Departments,
ct B g
with appropriate relationships established between them. This
3 Emily Proje Mr. Adams Sales
normalization would eliminate redundancy, improve data
ct C
integrity, and prevent the occurrence of these anomalies.
NULL NULL Proje NULL NULL
ct D
2. Update Anomaly:
|------------|--------------|--------------|----------------|---------------|