Академический Документы
Профессиональный Документы
Культура Документы
Members :
By Group
A
EKRAJ KOIRALA
KRISHNA GUPTA
SHIVCHANDRA
KARKI
DATE :
2071/04/2
Relational Database
Design
Contents:
1. Relational Database Design
1.1. Introduction to Anomalies
1.2. Functional dependencies
1.3. Decomposition
1.4. Introduction to Normalization
1.4.1. First Normal Form
1.4.2. Second Normal Form
1.4.3. Third Normal Form
1.4.4. BCNF
1.1. Introduction to
Anomalies:
Anomalies
anomalies
Deletion
anomalies
anomalies
Modification Anomalies:
Insertion Anomalies:
Deletion Anomalies:
A FFD occur when the requirement for a f.d. is already met and the set of
attributes on the left side of the f.d. statement cannot be reduced farther.
For example:{SSN,age}name , is a f.d. but is not a FFD because
age from the left side of the statement can be removed without impacting
the dependency relationships.
Transitive dependencies:
Multi-valued dependencies:
1.3. Decomposition:
Property of Decomposition:
This ensures we can never get the situation where false tuples
are generated, as for any value on the join attributes there will
be a unique tuple in one of the relations.
For example : R=(A,B,C,D,E).we decompose into
R1=(A,B,C), R2(A,D,E). The set of function dependencies is:
ABC, CDE,BD, EA. Then,
R1R2=A;
(ABC)=>(AABC)=>(R1R2R1) is a lossless
decomposition.
As an example
lets imagine were creating a database
of the children in a class, and the pets
they have. When starting to build this
database, the first approach might be
to create a simple table with all of the
information in one place, and one row
for each student.
TABLE: STUDENTS
Name
Age
Pet
Ram
15
Dog
Pet
Name
Puppy
Krishna
21
Tiger
Hunter
Priyanka
14
Cat
Susmu
Bikash
21
Dog
Bhusiya
This works until you realize that Ram might have two pets,
a dog and a cat. How would you represent that in this
table? In order to do that, we need to introduce first
normal form.
Forms :
TABLE: STUDENTS
Name
Age
Pet
Ram
15
Dog
Pet
Name
Puppy
Ram
15
Cat
Tara
Krishna
21
Tiger
Hunter
Priyanka
14
Cat
susmu
Bikash
21
Dog
Bhusiya
TABLE: STUDENTS
Name
Age
15
21
14
21
Ram
Krishna
Priyanka
Bikash
TABLE: PETS
Pet Name
Type
Owner
Puppy
Dog
Ram
Tara
Cat
Ram
Hunter
Tiger
Krishna
susmu
Cat
Priyanka
Bhusiya
Dog
Bikash
3 Normalization Form
A relational schema R is in 3NF if every
nonprime attribute of R meets both of the
following conditions:
1. it is fully functionally dependent on every
key of R.
2.it is non-transitively dependent on every
key of R.
ename
ename
ssn
ssn
bdate
bdate
address
address
dnumber
dnumber
dname
dnumber
Dmgr-ssn
dname
Dmgr-ssn
Test and
remedy(normalization) of 3NF
Test
Normalization
Relation should not have Decompose and set up a
a nonkey attribute
relation that includes
functionallydetermine
the non-key attributes
d by
that functionally
determine other nonanother nonkey
key attributes
attributes.that is ,
there should be no
transitive dependency
of a nonkey attribute
on the primary key