Disclaimer: This presentation is prepared bytrainees of baabtra as a part of mentoringprogram. This is not official document of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte SystemTechnologies Pvt . Ltd
ANOMALIES IN DATABASES email@example.com @Vishnu_Kishor
Database Anomalies• Databases are designed to collect data and sort or present it in specific ways to the end user• Database anomalies-unmatched or missing information caused by limitations or flaws within a given database• Entering or deleting information cause issues if the database is limited or has ‘bugs’.
Modification/Update Anomalies• They are the data inconsistencies that resulted from data redundancy or partial update.• The Problems resulting from data redundancy in database table are known as update anomalies.• If a modification is not carried out on all the relevant rows, the database will become inconsistent• Any database insertion, deletion or modification that leaves the database in an inconsistent state is said to have caused an update anomaly.
Insertion Anomalies• Issues that come about when you are inserting information into the database for the first time.• To insert the information into the table – Must enter the correct details – Must be consistent with the values for the other rows. – Missing or incorrectly formatted entries are two of the more common insertion errors.• Most developers acknowledge that this will happen and build in error codes that tell you exactly what went wrong.
Deletion Anomalies• Issues with data being deleted either – when attempting to delete and being stopped by an error or – by the unseen drop off of data• If we delete a row from the table that represents the last piece of data, the details about that piece are also lost from the Database.• These are the least likely to be caught or to stop you from proceeding• As many deletion errors go unnoticed for extended periods of time, they could be the most costly in terms of recovery
• Database anomalies are a fact• we will all face them in one form or another in life.• The importance of – backing up, – storing offsite and – data consistency checks come into full focus when you consider what could be lost.
Example To understand why we should be careful in designing databases, lets consider an example of a bad database design• Here the cust ID and stock are the primary key.
• Insertion Anomalies – You may want to add information about a person with whom you want to do business. – The above table only allows information for customers that own a share of stock. – If the person does not own stock, then the last four columns in the table have to be empty – This is not allowed since stock is part of the primary identifier• Deletion Anomalies – You may want to delete a record from the above table because a customer sold his stock. – Consider the second record. – If this record were deleted, then information would be lost about both Joness address and the price of C stock.
• Update Anomalies – You may want to update a customers address, the price of a stock, or its most recent dividend. – To accomplish this update, you would have to update several rows in the table. – If you miss one of the rows that should be updated, then at a later time you will get two different answers to a question you ask of the data. – This is not good. Generally, if there is only supposed to be one answer to a question, you want to get just that one answer.
How To Avoid Anomalies??• The use of normalization• The goal of the normalization process is to define relations• So that each relation is about one kind of thing. Not two. Not three. One.• This seems like a reasonable condition, given the problems that it prevents
How Normalization works??• If you know a customer id, then you know the persons name and address.• If you know a stock identifier, then you know its current price and most recent dividend.• Finally, for any pairing of a customer id and a stock identifier, you know how many shares that person owns of that stock
QUESTIONS ARE GUARANTEED INLIFE BUT ANSWERS ARE NOT…!! . . ANY QUESTIONS????