2. 1/16/2023 Lecture 8
Which one is better?
• Versus this one:
EID Name DeptID DeptName
A01 Ali 12 IT
A12 Eric 10 Sales
A13 Eric 12 IT
A03 Tyler 12 IT
EmpDept
Emp
EID Name DeptID
A01 Ali 12
A12 Eric 10
A13 Eric 12
A03 Tyler 12
Dept
DeptID DeptName
12 IT
10 Sales
3. ANOMALIES
• Tables that have redundant data have
problems known as anomalies. So data
redundancy is a cause of an anomaly.
• Redundancy is the duplication of the data.
4. There are 3 types of anomalies
1: Insert Anomaly: When you insert a record without having it stored on
the related record
2: Delete Anomaly: When you delete some information and lose valuable
related information at the same time.
3: Update Anomaly: Any change made to your data will require you to scan
all records to make the changes multiple time.
5. Insert anomaly
• An Insert Anomaly occurs when certain
attributes cannot be inserted into the
database without the presence of other
attribute
6. Example
Course _no Tutor Room Room_size En_limit
353 Smith A532 45 40
351 Smith C320 100 60
355 Clark H940 400 300
456 Turner H940 400 45
e.g. we have built a new room (e.g. B123) but it has not yet been timetabled for any
courses or members or staff.
7. Delete Anomaly
• A Delete Anomaly exists when certain
attributes are lost because of the
deletion of other attributes.
8. Example
Course _no Tutor Room Room_size En_limit
353 Smith A532 45 40
351 Smith C320 100 60
355 Clark H940 400 300
456 Turner H940 400 45
e.g. if we remove the entity, course_no:351 from the above table, the details of
room C320 get deleted. Which implies the corresponding course will also get
deleted.
9. Update Anomaly
• An Update Anomaly exists when one or
more instances of duplicated data is
updated, but not all.
10. Example
Course _no Tutor Room Room_size En_limit
353 Smith A532 45 40
351 Smith C320 100 60
355 Clark H940 400 300
456 Turner H940 400 45
e.g. Room H940 has been improved, it is now of Room_Size = 500. For
updating a single entity, we have to update all other columns where
room=H940.