Normalisation of something i dont know and will never know
Anshuman0211
8 views
34 slides
Oct 18, 2024
Slide 1 of 34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
About This Presentation
presentation
Size: 988.51 KB
Language: en
Added: Oct 18, 2024
Slides: 34 pages
Slide Content
2
nd
Normal Form
A relation schema is in 2NF if it
satisfies 1NF and every non key
attribute is fully functionally
dependent on the primary key of
Relation.
Example of 2NF
EMP_PROJ is 1NF with Key SSN, PNUMBER but…
SSN ENAME - ENAME, a Non-Prime Attribute, Depends Partially
on SSN, PNUMBER, i.e., Depends on Only SSN and not Both
PNUMBER {PNAME, PLOCATION} - PNAME, PLOCATION, two
Non-Prime Attributes, Depends Partially on SSN, Pno i.e., Depends
on Only PNo ¬ Both
Another Example of 2NF
Third Normal Form (3NF)
It is based on the concept of
transitive dependency. A functional
dependency XY in a relation
schema R is a transitive dependency
if there is a set of attributes Z that is
neither a candidate key nor a subset
of any key of R, and both XZ and
ZY hold.( Book Def)
EMP_DEPT
ENAME SSNBDATEADDRESS DNUMBER DNAME DMGRSS
N
Here, SSNDNAME
Since SSNDNUMBER and
DNUMBERDNAME holds.
A relation schema R is said to be in 3NF if it
satisfies 2NF and no nonprime attribute of R is
transitively dependent on the Primary key. To
normalize from 2NF to 3NF, decompose and
set up a relation that includes the non-prime
attribute that functionally determine other
non-prime attribute and remove this attribute
from the original relation.
Relation Schema EMP_DEPT is not in 3NF but it
is in 2NF as no partial dependency on a key
exists.
To normalize EMP_DEPT into 3NF we
decompose it into two 3NF relation
schemas as shown:
ENAME SSNBDATEADDRESS DNUMBER DNAME DMGRSS
N
ENAME SSNBDAT
E
ADDRESS DNUMBE
R
DNUMBE
R
DNAME DMGRSS
N
ED1
ED2
Consider a LOTS relation schema that
describes plots for sale in various states of
countries .
It has two candidate keys PROPERTY_ID#
and {COUNTRY_NAME,LOT#}.
Also we assume that tax rate is determined
by country name. Also price of a lot is
determined by it’s area.
PROPERTY
_ID#
COUNTRY_N
AME
LOT#AREAPRICE TAX_RATE
Determine all FDs.
And Normalise the
relation schema to
3
rd
Normal Form.
Decomposition into 2NF
LOTS1
PROPERTY
_ID#
COUNTRY_N
AME
LOT#AREAPRICE
LOTS2
COUNTRY_NAM
E
TAX_RATE
Normalizing LOTS1 into 3NF
(lots 2 will remain as it is)
PROPERTY
_ID#
COUNTRY_NAME LOT#AREA
LOTS1A
LOTS1B
AREA PRICE
Boyce-Codd Normal Form
A relation is in BCNF if and only if every
nontrivial, left-irreducible FD has a
candidate key as it’s determinant. Hence,
for every nontrivial, left-irreducible FD
XA, X should be a candidate key. The
difference between 3NF and BCNF is that
3NF allows A to be a prime attribute.
Every relation that in BCNF is also in 3NF,
however a relation in 3NF is not necessarily
in BCNF.For example,
In simple terms
Superkey
4 NF
Fourth normal form (4NF) is a level of
database normalization where there
are no non-trivial multivalued
dependencies other than a candidate
key. It builds on the first three normal
forms (1NF, 2NF and 3NF) and the
Boyce-Codd Normal Form (BCNF
Properties :
A relation R is in 4NF if and only if the
following conditions are satisfied:
1.It should be in the Boyce-Codd
Normal Form (BCNF).
2.the table should not have any Multi-
valued Dependency.
A table with a multivalued dependency
violates the normalization standard of
Fourth Normal Form (4NK) because it
creates unnecessary redundancies and
can contribute to inconsistent data. To
bring this up to 4NF, it is necessary to
break this information into two tables.
example
SID SNAME
S1 A
S2 B
Table – R1(SID, SNAME)
Table – R2(CID, CNAME)
CID CNAME
C1 C
C2 D
SID SNAME CID CNAME
S1 A C1 C
S1 A C2 D
S2 B C1 C
S2 B C2 D
Multivalued dependencies (MVD) are:
SID->->CID; SID->->CNAME; SNAME->->CNAME
Normal Form (5NF):
A relation R is in 5NF if and only if
every join dependency in R is implied
by the candidate keys of R. A relation
decomposed into two relations must
have loss-less join Property, which
ensures that no spurious or extra
tuples are generated, when relations
are reunited through a natural join.
Properties – A relation R is in 5NF if
and only if it satisfies following
conditions:
1.R should be already in 4NF.
2.It cannot be further non loss
decomposed (join dependency)
The relation ACP is again decompose into 3 relations. Now, the natural
Join of all the three relations will be shown as:
Agent Company
A1 PQR
A1 XYZ
A2 PQR
Table – R1
Result of Natural Join of R1 and R3 over
‘Company’ and then Natural Join of R13 and
R2 over ‘Agent’and ‘Product’ will be
table ACP.
Hence, in this example, all the redundancies
are eliminated, and the decomposition of
ACP is a lossless join decomposition.
Therefore, the relation is in 5NF as it does
not violate the property of lossless join.