Database Anomalies

Context: FIT2094_MOC · insert, update, delete problems from poor table structure · caused by redundancy · removed by Normalisation

Quick Revision

  • 🎯 Objective: data problems from poor relation structure ➔ redundancy → inconsistency.
  • 📦 Core Components: insert ➔ update ➔ delete anomalies.
  • ⚡ Key Constraint: root cause is one table mixing independent subjects; cured by Normalisation.

📝 Core

1. The Anomalies

  • Insert ➔ adding data forces unrelated data you may not have.
  • Update ➔ one fact in many rows ⟹ multi-row edit, risk of inconsistency.
  • Delete ➔ removing a tuple loses co-located data that existed nowhere else.

2. Root Cause

  • One table, many subjects ➔ drugs and reps together.
  • Existence tied ➔ one subject’s existence depends on another’s.
  • Fix ➔ split into single-subject relations (Normalisation).

⚖️ Core Decision Matrix

AnomalyTriggerConsequence
insertadd data needing another subjectcan’t add
updatefact repeated in rowsinconsistency
deleteremove last co-located rowdata loss
causemixed subjectsredundancy

When It Flips: update anomalies directly threaten consistency (two mobile numbers for one rep). Diagnosis guides design: which anomaly a table suffers points to the transitive dependency to remove.

📊 Exam Execution Trace

Manual Execution Trace

Diagnosing DRUG/SLSREP:

Step / StateOperationAnomaly
0 (Init)
1add new repinsert
2change rep mobileupdate
3delete rep’s only drugdelete

⚠️ Common Mistakes

  • 💡 Anomalies are structural, not data-entry errors ➔ they persist regardless of care until the schema is normalised.

🧠 Active Recall