Database Systems: Activity (Anomalies)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Database Systems

Activity (Anomalies)
Fall-2020

Submitted by:
Name: Muhammad Saud Ali
Student ID: F2019105048
Section: Y1

Submitted on:
04/01/2020
Submitted to:
Ms. Taila Jabeen

Department of Informatics and Systems


University of Management and Technology
Q1- Describe three different types of data anomalies. Also, provide 5
different relational and identify all anomalies in each relation.

There are three types of anomalies;


• Insertion anomaly
• Update anomaly
• Deletion anomaly

Insertion anomalies happen when we try to insert some important data into the
database table but could not, because that data, in some manner is dependent on
other attributes of that same table. For example, if we feel the need to add a new
category of movies into the table, but we can not add this detail unless there is some
movie and its details are also inserted. This shows how the category is dependent on
the movie details and causes the insertion anomaly.

Update anomalies happen when there is data redundancy in the table. For example,
there is an HOD for every department and in the table due to data redundancy, with
every student the department and HOD is written, now if the HOD for physics
department is changed we will have to make the change in every record where the
department is physics, in case if we miss any of it, there will be multiple values of HOD
for the physics department causing update anomaly.

Deletion anomalies happens when we intend to delete some information from the
table but because of that the unwanted information also gets deleted. This happens
due to data dependency. For example, in a table we have details of branch and details
of employee working there, the branch data will be dependent on the employee data,
if we intend to delete the employee data and keep the branch data, that would cause
deletion anomaly and will delete the unwanted data as well.
Table1
EmployeeID Name DepartmentNo DeptName HOD
1 Jack 21 Accounts Alex
2 Marven 41 Human Resource Saira
3 Peter 21 Accounts Alex
4 Stale 44 Information Tech Luke
5 Jack 12 Marketing Steve
6 Bell 51 Production Morgan

Insertion anomaly;
If we want to insert a new department in the table, we will face insertion anomaly
because the employee ID is the primary key and the department’s data is dependent
on the employee’s data. So, we will not be able to insert a new department unless we
have some employee working in that department.

Update anomaly;
If there occurs a situation where the name of the accounts department is to be changed
to finance management, and we start changing the name of the department to finance
management but we accidently miss some record having old data. Because of this
there will occur inconsistency in data causing update anomaly.

Deletion anomalies;
Say some employee leaves a particular department or gets promoted into some other
department and we no longer require the data so wo try to delete the employee’s data
purposely but due to data dependency the unwanted data of department will also get
deleted causing deletion anomaly.
Table2
TeacherID Name SubjectID SubjectName
1 Jack CS212 Computer Science
2 Marven IT413 Information Tech
3 Peter CS212 Computer Science
4 Stale SE445 Software Eng
5 Jack PY102 Physics
6 Bell CM512 Chemistry

Insertion anomaly;
If we want to insert a new subject in the table, we will face insertion anomaly
because the teacher ID is the primary key and the subject’s data is dependent on the
teacher’s data. So, we will not be able to insert a new subject unless we have some
teacher teaching it.

Update anomaly;
If there occurs a situation where the name of the computer science subject is to be
changed to computer systems, and we start changing the name of the subject to
computer systems but we accidently miss some record having old data. Because of
this there will occur inconsistency in data causing update anomaly.

Deletion anomalies;
Say some teacher stops teaching some particular or leaves the school and we no
longer require the data so wo try to delete the teacher’s data purposely but due to
data dependency the unwanted data of subject will also get deleted causing deletion
anomaly.
Table3
BookingID CustomerName RoomNo Hotel Rating City
1441S2AA Steven 214 LaMontana 5star Indiana
40223GSQ Mike 402 HolidyInn 3star California
514PPOS3 Peterson 522 PerlContinental 7star Vegas
24412X31 David 109 LaMontana 5star Indiana
1044LLA1 William 222 SweetHomes 3star Miami
205YI81V Miami 501 Luxus Grand 7star Texas

Insertion anomaly;
If we want to insert a new hotel details in the table, we will face insertion anomaly
because the Booking ID is the primary key and the Hotel’s data is dependent on the
bookings’ data. So, we will not be able to insert a new hotel details unless we have
some booking in that particular hotel.

Update anomaly;
If there occurs a situation where the rating of some hotel drops or gets better and is
to be changed accordingly. Say we start changing the rating of the hotel LaMontana
from 5 stars to 3 stars but we accidently miss some record having old data. Because
of this there will occur inconsistency in data causing update anomaly.

Deletion anomalies;
Say some booking details gets too old to be saved and we no longer need it. So, we
try to delete the bookings’ data purposely but due to data dependency the unwanted
data of hotel will also get deleted causing deletion anomaly.
Table4
CourseID CourseName HallNo Timings ProfessorID Professor
CS101 Computing N201 12:30PM F2019311 Hussy
SE201 Database S202 11:00AM S2012330 Gayle
GSE10 Spanish S102 08:00AM F2014023 Sully
IT244 Programming N201 02:00PM F2061233 Sam
IT451 Networking C404 03:30PM F2019311 Hussy
RS319 Ethics S104 05:00PM S2018002 Jeffery

Insertion anomaly;
If we want to insert a new Professor in the table, we will face insertion anomaly
because the course ID is the primary key and the professor’s data is dependent on
the course’s data. So, we will not be able to insert new professor’s details unless he
has given some subject to teach.

Update anomaly;
If there occurs a situation where the professor Hussy’s ID changes and we have to
change the professor Hussy’s ID. And we start changing the ID but we accidently
miss some record having old data. Because of this there will occur inconsistency in
data having multiple IDs for same professor causing update anomaly.

Deletion anomalies;
Say some course is no longer offered in the university and we no longer require the
data so wo try to delete the course’s data purposely but due to data dependency the
unwanted data of the professor teaching that will also get deleted causing deletion
anomaly.
Table5
TransactionID MemberID Name BranchID Address Bank City
31239931 A41F1231 Sauthee G22123 495 S Main St, Las Citi Bank Vegas
55123512 KK21H292 Guptil B2312E 1826 Ponce de Leon Blv Barclays Miami
81266612 123IS123 Stevenson S66092 1105 W Woodlawn Ave Standard Chartered Tampa
12555121 JA9821U9 Milan G22123 495 S Main St, Las Citi Bank Vegas
98276654 L987R3F7 Tall G22123 495 S Main St, Las Citi Bank Vegas
91237122 N43A7G66 River P22O91 65 John Rd. Astoria Bank of America New York City

Insertion anomaly;
If we want to insert a new bank in the table, we will face insertion anomaly because
the transaction ID is the primary key and the bank’s data is dependent on the
employee’s data. So, we will not be able to insert a new department unless we have
some employee working in that department.

Update anomaly;
If there occurs a situation where the bank shifts to some other address and the old
address is to be changed, and we start changing the old bank address to new bank
address and we accidently miss some record having old data. Because of this there
will occur inconsistency in data causing update anomaly.

Deletion anomalies;
Say some transaction details gets way too old and we no longer require that data so
wo try to delete the transaction’s data purposely but due to the data dependency the
unwanted data of the bank will also get deleted causing deletion anomaly.

You might also like