SlideShare a Scribd company logo
Anomalies in database
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Anomalies in Database
Name
@abhishekmenon121989@gmail
.com
www.facebook.com/
Abhishek H menon
twitter.com/Abhishek H
Menon
in.linkedin.com/in/Abhishek
H menon
Anomaly
Normalization is a technique for producing
relational schema with the following
properties.
• no information redundancy.
• no anomalies.
so we are clear when the process of reducing
the anomaly comes into action.
What is an Anomaly?
• Definition
– Problems that can occur in poorly planned, un-
normalized databases where all the data is stored
in one table (a flat-file database).
Types of Anomalies
• Insert
• Delete
• Update
Insert Anomaly
• An Insert Anomaly occurs when certain
attributes cannot be inserted into the
database without the presence of other
attributes.
Insert Anomaly
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 of staff.
Delete Anomaly
• A Delete Anomaly exists when certain
attributes are lost because of the deletion of
other attributes.
Delete Anomaly
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.
Update Anomaly
• An Update Anomaly exists when one or more
instances of duplicated data is updated, but
not all.
Update Anomaly
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 RSize = 500. For updating
a single entity, we have to update all other columns where room=H940.
A conceptual model
• Consider the following ‘simple’ conceptual
data model:
Staff( Staff-id, Name,address, scale_point, Rate_of_pay, DOB..)
Student(Enroll-no, Name, Address, Olevelpoints..)
Course(Course-code, Name, Duration..)
Course StudentStaff
M M1N
The ‘Translation’ process
• Entities become relations.
• Attributes become attributes.
• Entity identifier (s) become primary key(s)
• Relationships are represented by additional
foreign keys attributes in those relation that
are at the ‘M’ end of the 1:M relationship.
The ‘Staff’ and ‘Student’ relations
• Staff(Staff-id, Name , Address, Rate-of-pay, DOB)
• Student(Enrol-no, Name, Address, Olevelpoints, Tutor);
NB: Foreign Key Tutor references Staff.Staff_id
Staff_id Name Address Scale point Rate_of_pay DOB
Enrol-no Name Address Olevelpoints Tutor
The ‘Staff’ & ‘Course’ relations
• Staff
• Course
NB: according to the conceptual model specified, both the above entities
have M:M relationships at the end.
We must create an artificial link in between these two entities.
Staff_id Name Address Scalepoint Rate_of_pay DOB
Course-code Name Duration
The ‘Staff’, ‘Course’ and ‘Team’ relations
• Staff
• Team
• Course
Staff_id Name Address Scalepoint Rate_of_pay DOB
Course_code Staff_id
Course_code Name Duration
The ‘Staff’, ‘Course’ and ‘Team’ relations
• In our new relation ‘Team’:
– Primary key is the combination of Course_code
and Staff_id.
– Foreign key Course_code references
Course.Course_code.
– Foreign key Staff_id references Staff.Staff_id.
For 3 entities 4 relations
• Student
• Staff
• Team
• Course
But these tables are not free from the above anomalies!
Enrol_no Name Address Olevelpoints Tutor
Staff_id Name Address Scalepoint RateofPay DOB
Course_code Staff_id
Course_code Name Duration
Checking for anomalies
• every tuple unique?
• no hidden meaning from location?
• data cells atomic?
• For relations with single_attribute keys:
– every attribute depends upon the primary key
• For relations with composite keys:
– Every attribute depends upon the whole key(the
components of this key are prime attributes?)
Relation fails
• Especially when we check dependency between
various attributes in a relationship.
• So we must split that relation into two relations.
• And we should create a foreign key in the new table
which references the primary key in the old table.
Problem arises
• The attribute ‘Rate_of_pay’ does not depends on the ‘Staff_id’ but on
‘Scalepoint’ in the relation Staff.
• So the next step will be splitting the relation Staff into relation Staff and
relation Pay.
Staff
Pay
Where in new relation Pay;
Combination of Scalepoint and rate_of_pay is taken as primary key.
Foreign key Scalepoint references Staff.Scalepoint.
Staff_id Name Address Scalepoint DOB
Scalepoint Rate_of_Pay
For 3 entities 5 relations
• Student
• Staff
• Team
• Course
• Pay
Enrol_no Name Address Olevelpoints Tutor
Staff_id Name Address Scalepoint DOB
Course_code Staff_id
Course_code Name Duration
Scalepoint Rate_of_pay
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us

More Related Content

PPTX
Functional dependencies and normalization
PPT
chapter 5-Relational Algebra and calculus.ppt
PPTX
Normal forms
PPTX
Dbms 4NF & 5NF
PPTX
Relational Algebra,Types of join
PPTX
Database Concept - Normalization (1NF, 2NF, 3NF)
PPTX
Functional dependency
PPT
Normalization
Functional dependencies and normalization
chapter 5-Relational Algebra and calculus.ppt
Normal forms
Dbms 4NF & 5NF
Relational Algebra,Types of join
Database Concept - Normalization (1NF, 2NF, 3NF)
Functional dependency
Normalization

What's hot (20)

PPTX
Relational algebra ppt
PPSX
Functional dependency
PPT
1. Introduction to DBMS
PDF
Normalization in DBMS
PPTX
Database architecture
PPTX
SQL commands
PPTX
Transaction management DBMS
PPTX
Tree - Data Structure
PPTX
Normalization in DBMS
PPTX
SQL, Embedded SQL, Dynamic SQL and SQLJ
PPTX
SQL Queries Information
PPTX
Acid properties
PPT
Databases: Normalisation
PPTX
Relational model
PPTX
Data Dictionary
PPTX
Normalization in DBMS
PDF
Database Normalization
PPTX
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
PPTX
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Relational algebra ppt
Functional dependency
1. Introduction to DBMS
Normalization in DBMS
Database architecture
SQL commands
Transaction management DBMS
Tree - Data Structure
Normalization in DBMS
SQL, Embedded SQL, Dynamic SQL and SQLJ
SQL Queries Information
Acid properties
Databases: Normalisation
Relational model
Data Dictionary
Normalization in DBMS
Database Normalization
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Ad

Similar to Anomalies in database (20)

PPTX
PPT
Normmmalizzarion.ppt
PPTX
Nomalization in database mnanagement.pptx
PDF
Chapter 4 notes DBMS.pdf
PPTX
DBMS (UNIT 2)
PPTX
Week 5 Update Anomalies.pptx
PPTX
database ds...normalization data base
PPTX
database ds...normalization in data base
PPTX
Database normalaization with examples.pptx
PPTX
Data Redundancy & Update Anomalies
PPTX
Chap04 (normalization 1 2 3 form ).pptx
PPTX
Relational database
PDF
normalization
PPT
Chapter six - Normalization.ppt fundamental of db
PPTX
DBMS_Module 3_Functional Dependencies and Normalization.pptx
PPTX
04 CHAPTER FOUR - INTEGRITY CONSTRAINTS AND NORMALIZATION.pptx
PPTX
L1-Normalization 1NF 2NF 3NF 4NF BCNF.pptx
PPTX
09.01 normalization
PDF
DBMS 3.pdf
PPTX
normalization In data base lecture no sixth
Normmmalizzarion.ppt
Nomalization in database mnanagement.pptx
Chapter 4 notes DBMS.pdf
DBMS (UNIT 2)
Week 5 Update Anomalies.pptx
database ds...normalization data base
database ds...normalization in data base
Database normalaization with examples.pptx
Data Redundancy & Update Anomalies
Chap04 (normalization 1 2 3 form ).pptx
Relational database
normalization
Chapter six - Normalization.ppt fundamental of db
DBMS_Module 3_Functional Dependencies and Normalization.pptx
04 CHAPTER FOUR - INTEGRITY CONSTRAINTS AND NORMALIZATION.pptx
L1-Normalization 1NF 2NF 3NF 4NF BCNF.pptx
09.01 normalization
DBMS 3.pdf
normalization In data base lecture no sixth
Ad

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
PDF
Acquiring new skills what you should know
PDF
Baabtra.com programming at school
PDF
99LMS for Enterprises - LMS that you will love
PPTX
Chapter 6 database normalisation
PPTX
Chapter 5 transactions and dcl statements
PPTX
Chapter 4 functions, views, indexing
PPTX
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
PPTX
Chapter 1 introduction to sql server
PPTX
Chapter 1 introduction to sql server
Agile methodology and scrum development
Acquiring new skills what you should know
Baabtra.com programming at school
99LMS for Enterprises - LMS that you will love
Chapter 6 database normalisation
Chapter 5 transactions and dcl statements
Chapter 4 functions, views, indexing
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 1 introduction to sql server
Chapter 1 introduction to sql server

Recently uploaded (20)

PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Pre independence Education in Inndia.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Cell Structure & Organelles in detailed.
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Classroom Observation Tools for Teachers
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Microbial diseases, their pathogenesis and prophylaxis
Basic Mud Logging Guide for educational purpose
Final Presentation General Medicine 03-08-2024.pptx
Pre independence Education in Inndia.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
VCE English Exam - Section C Student Revision Booklet
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Complications of Minimal Access Surgery at WLH
Cell Structure & Organelles in detailed.
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Renaissance Architecture: A Journey from Faith to Humanism
Abdominal Access Techniques with Prof. Dr. R K Mishra
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Classroom Observation Tools for Teachers
2.FourierTransform-ShortQuestionswithAnswers.pdf
TR - Agricultural Crops Production NC III.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student

Anomalies in database

  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3. Anomalies in Database Name @abhishekmenon121989@gmail .com www.facebook.com/ Abhishek H menon twitter.com/Abhishek H Menon in.linkedin.com/in/Abhishek H menon
  • 4. Anomaly Normalization is a technique for producing relational schema with the following properties. • no information redundancy. • no anomalies. so we are clear when the process of reducing the anomaly comes into action.
  • 5. What is an Anomaly? • Definition – Problems that can occur in poorly planned, un- normalized databases where all the data is stored in one table (a flat-file database).
  • 6. Types of Anomalies • Insert • Delete • Update
  • 7. Insert Anomaly • An Insert Anomaly occurs when certain attributes cannot be inserted into the database without the presence of other attributes.
  • 8. Insert Anomaly 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 of staff.
  • 9. Delete Anomaly • A Delete Anomaly exists when certain attributes are lost because of the deletion of other attributes.
  • 10. Delete Anomaly 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.
  • 11. Update Anomaly • An Update Anomaly exists when one or more instances of duplicated data is updated, but not all.
  • 12. Update Anomaly 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 RSize = 500. For updating a single entity, we have to update all other columns where room=H940.
  • 13. A conceptual model • Consider the following ‘simple’ conceptual data model: Staff( Staff-id, Name,address, scale_point, Rate_of_pay, DOB..) Student(Enroll-no, Name, Address, Olevelpoints..) Course(Course-code, Name, Duration..) Course StudentStaff M M1N
  • 14. The ‘Translation’ process • Entities become relations. • Attributes become attributes. • Entity identifier (s) become primary key(s) • Relationships are represented by additional foreign keys attributes in those relation that are at the ‘M’ end of the 1:M relationship.
  • 15. The ‘Staff’ and ‘Student’ relations • Staff(Staff-id, Name , Address, Rate-of-pay, DOB) • Student(Enrol-no, Name, Address, Olevelpoints, Tutor); NB: Foreign Key Tutor references Staff.Staff_id Staff_id Name Address Scale point Rate_of_pay DOB Enrol-no Name Address Olevelpoints Tutor
  • 16. The ‘Staff’ & ‘Course’ relations • Staff • Course NB: according to the conceptual model specified, both the above entities have M:M relationships at the end. We must create an artificial link in between these two entities. Staff_id Name Address Scalepoint Rate_of_pay DOB Course-code Name Duration
  • 17. The ‘Staff’, ‘Course’ and ‘Team’ relations • Staff • Team • Course Staff_id Name Address Scalepoint Rate_of_pay DOB Course_code Staff_id Course_code Name Duration
  • 18. The ‘Staff’, ‘Course’ and ‘Team’ relations • In our new relation ‘Team’: – Primary key is the combination of Course_code and Staff_id. – Foreign key Course_code references Course.Course_code. – Foreign key Staff_id references Staff.Staff_id.
  • 19. For 3 entities 4 relations • Student • Staff • Team • Course But these tables are not free from the above anomalies! Enrol_no Name Address Olevelpoints Tutor Staff_id Name Address Scalepoint RateofPay DOB Course_code Staff_id Course_code Name Duration
  • 20. Checking for anomalies • every tuple unique? • no hidden meaning from location? • data cells atomic? • For relations with single_attribute keys: – every attribute depends upon the primary key • For relations with composite keys: – Every attribute depends upon the whole key(the components of this key are prime attributes?)
  • 21. Relation fails • Especially when we check dependency between various attributes in a relationship. • So we must split that relation into two relations. • And we should create a foreign key in the new table which references the primary key in the old table.
  • 22. Problem arises • The attribute ‘Rate_of_pay’ does not depends on the ‘Staff_id’ but on ‘Scalepoint’ in the relation Staff. • So the next step will be splitting the relation Staff into relation Staff and relation Pay. Staff Pay Where in new relation Pay; Combination of Scalepoint and rate_of_pay is taken as primary key. Foreign key Scalepoint references Staff.Scalepoint. Staff_id Name Address Scalepoint DOB Scalepoint Rate_of_Pay
  • 23. For 3 entities 5 relations • Student • Staff • Team • Course • Pay Enrol_no Name Address Olevelpoints Tutor Staff_id Name Address Scalepoint DOB Course_code Staff_id Course_code Name Duration Scalepoint Rate_of_pay
  • 24. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com