Database Management System

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 23

DATABASE MANAGEMENT

SYSTEM
DBMS
CONTENTS

 Anomalies in DBMS
 Types of Anomalies in DBMS
 Functional Dependency
 Types of Functional Dependency
 Normalization
 Problems by redundancy
 Types of Normalization
What are the Anomalies in DBMS?

 A database anomaly is a data inconsistency caused by an operation


such as an insertion, deletion, or update. When a record is held in
multiple locations, and not all copies are updated, inconsistencies
can occur.
Types of Anomalies in DBMS

There are various types of anomalies in DBMS that are as follows:


 Insert Anomalies in DBMS
 Update Anomalies in DBMS
 Delete Anomalies in DBMS
Example

 Consider a manufacturing firm that keeps worker information


in a table called employee, which has four columns: w_id for
the employee’s id, w_name for the employee’s name,
w_address for the employee’s address, and w_dept for the
employee’s department. The table will look like this at some
point:
w_id w_name w_address w_dept

201 David Delhi F001

201 David Delhi F002

223 Mike Agra F890

266 Berry Chennai F900

266 Berry Chennai F004


Update Anomaly

 Employee David has two rows in the table given above since
he works in two different departments. If we want to change
David’s address, we must do so in two rows, else the data
would become inconsistent.
 If the proper address is updated in one of the departments
but not in another, David will have two different addresses in
the database, which is incorrect and leads to inconsistent
data.
Insert Anomaly

 Ifa new worker joins the firm and is currently


unassigned to any department, we will be unable to
put the data into the table because the w_dept field
does not allow nulls.
Delete Anomaly

 Ifthe corporation closes the department F890 at


some point in the future, deleting the rows with
w_dept as F890 will also erase the information of
employee Mike, who is solely assigned to this
department.
FUNCIONAL DEPENDENCY

A Functional dependency in DBMS refers to a relationship that is present between


attributes of any table that are dependent on each other. E. F. Codd introduced it, and
it helps in avoiding data redundancy and getting to know more about bad designs.
XY
 Xdeterminant
 Ydependent
EXAMPLE

Roll no name age


1 aa 20
2 bb 21
3 cc 20

 Rollnoname
 Rollnoage
Trivial Functional Dependency

 Trivial − If a functional dependency (FD) X → Y holds, where Y is a subset of X, then it


is called a trivial FD.
 A dependent is always a subset of determinant.
Eg;
 Rollno ,name  name
 Rollno ,nameRollno
NON-Trivial Functional Dependency

 If an FD X → Y holds, where Y is not a subset of X, then it is called a non-trivial FD.


 A dependent is strictly not a subset of determinant.
Eg;
 Rollnoname
 Rollnoname,age
Normalization

 Normalization is the process of organizing the data in the database.


 Normalization is used to minimize the redundancy from a relation or set of
relations. It is also used to eliminate undesirable characteristics like Insertion,
Update, and Deletion Anomalies.
 Normalization divides the larger table into smaller and links them using
relationships.
 The normal form is used to reduce redundancy from the database table.
 It is Used to reduse data redundancy.
 A Normalization process is first proposed by codd in 1972.
Problems by redundancy

 More memory
 More access time
 Data inconsistency
 Anomalies

Roll no Student name course Department name

1 A JAVA CS
1 A DATA SCIENCE CS
2 B PYTHON CS
Types of Normalization

Normalization are divided into 4:


 Normalization first
 Normalization second
 Normalization third
 Boyce codd normal forms
First Normal Form (1NF)

 If a relation contains a composite or multi-valued attribute, it violates the first normal


form, or the relation is in first normal form if it does not contain any composite or multi-
valued attribute. A relation is in first normal form if every attribute in that relation is
singled valued attribute.
 A table is in 1 NF if:
 There are only Single Valued Attributes.
 Attribute Domain does not change.
 There is a unique name for every Attribute/Column.
 The order in which data is stored does not matter.
Example

cid cname cthings


1 aaa Pen,book
2 bbb Pen,pencil

Solution:
cid cname cid cthings
1 aaa 1 pen
2 bbb
1 book
2 pen
2 pencil
Normalization second

 A relation is said to be in the 2nd Normal Form in DBMS (or 2NF) when it is in the First
Normal Form but has no non-prime attribute functionally dependent on any candidate
key’s proper subset in a relation.
 A relation’s non-prime attribute refers to that attribute that isn’t a part of a relation’s
candidate key.
Normalization third

 A given relation is said to be in its third normal form when it’s in 2NF but has no
transitive partial dependency. Meaning, when no transitive dependency exists for the
attributes that are non-prime, then the relation can be said to be in 3NF.
BCNF(Boys codd normal form)

 BCNF is the advance version of 3NF.


 It is stricter than 3NF.
 A table is in BCNF if every functional dependency X → Y, X is the super key of the table.
 For BCNF, the table should be in 3NF, and for every FD, LHS is super key.
THANK YOU

You might also like