0% found this document useful (0 votes)
10 views9 pages

Week 6

Uploaded by

Nandhu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views9 pages

Week 6

Uploaded by

Nandhu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

① Functional dependancy is

A - > B En determines B4
I A determiss
uniquely B
means
RODNO -> S name

Roll no determines names but with name We cannot determines


can be same two students
name
of
as name -

hand
*
Left side should be
unique
.

② sure
R (A , B 2) ,

f =
SA +
B ,
( -
B B+,
24
At =
S A3 SABY [AB2] , ,
- At will
give ABC

From Here , we can


say
A
+ ABC
A s BC -

Candidate
③ find Key !
How to

R (A , B. C
,D ,
E]
F =
SAB - 1
,
E- ,
BF + A ,
( >
-

B]

Step
17
--
-
Look of the
Right hand sides
of FD and Dee which
Key is

not present
Closin of
Step >
.
2 S Take that
key and check if you are
geting al
-

other
keys using that or not If
combination
.

yes , that must be in Candidate

key If .
not then take
of that with other
keyf
to chec if that is Candidate key
a

Note : Candidate all


keys in T
keys
will
give
.

Example : R(P & RS + UVw)

948 >
-

RSTV4 <W +
rY R (P & & $40 4()
< P-R3 4V +
V4 Poste not in right
side

20 53 +

SPORSTUVW}
(
-
&R +
WV3 POS
3V +
W3 Prime attribute
= P&

non-prime = R ,S ,
T U V
, , , W
Week - 06
Normalization

What is 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.

Why do we need Normalization?


The main reason for normalizing the relations is removing these anomalies. Failure to eliminate anomalies
leads to data redundancy and can cause data integrity and other problems as the database grows.
Normalization consists of a series of guidelines that helps to guide you in creating a good database structure.

Normalization is used for mainly 2 purposes:


• Eliminating redundant (useless) data

• Ensuring the data dependencies make sense, that is, data is logically stored

Normalization and Normal Forms

• A normal form specifies a set of of conditions that the relational schema must satisfy in terms of its

constraints — they offer varied levels of guarantee for the design

• Normalization rules are divided into various normal forms


• Most common normal forms are:

• First Normal Form (1NF)


• Second Normal Form (2NF)
• Third Normal Form (3NF)
• Informally, a relational DB relation is often described as "normalized" if it meets the 3NF (Third Normal
Form)

• Most 3NF are free from insertion, update and deletion anomalies
Additional Normal Forms:
• Elementary Key Normal Form (EKNF)

• Boyce-codd Normal Form (BCNF)

• Multi-valued Dependencies and Fourth Normal Form (4NF)

• Essential Tuple Normal Form (ETNF)

• Join Dependencies and Fifth Normal Form (5NF)

• Sixth Normal Form (6NF)

• Domain/Key Normal Form (DKNF)

Data modification anomalies can be categorized into three types:


Insertion Anomaly: Insertion Anomaly refers to when one cannot insert a new tuple into a relationship due to

lack of data.

Deletion Anomaly: The delete anomaly refers to the situation where the deletion of data results in the
unintended loss of some other important data.
Updatation Anomaly: The update anomaly is when an update of a single data value requires multiple rows of

data to be updated.

Types of Normal Forms:


Normalization works through a series of stages called Normal forms. The normal forms apply to individual
relations. The relation is said to be in particular normal form if it satisfies constraints.
1NF (First Normal Form) Rules
-Atomic
• Each table cell should contain a single value.
• Each record needs to be unique.
to

be
attached
-

can but
full name
K It in in
separate
Column .

What is Composite Key?


A composite key is a primary key composed of multiple columns used to identify a record uniquely

In our database, we have two people with the same name Robert Phil, but they live in different places.

Hence, we require both Full Name and Address to identify a record uniquely. That is a composite key.
Let’s move into second normal form 2NF
2NF (Second Normal Form) Rules

• Rule 1- Be in 1NF
• Rule 2- Single Column Primary Key that does not functionally dependant on any subset of
candidate key relation /NO Partial
dependency)

Candidate key determines


=> Mean
A proper subset of attribute
non prime

It is clear that we can’t move forward to make our simple database in 2nd Normalization form unless we
partition the table above.

Table &
Table 1

We have divided our 1NF table into two tables viz. Table 1 and Table2. Table 1 contains member information.
Table 2 contains information on movies rented. We have introduced a new column called Membership_id
which is the primary key for table 1. Records can be uniquely identified in Table 1 using membership id

Example :

Consider R in I NE

Candidate keys : -AB , BF , AC , BE

&
a single key or a group of multiple keys that uniquely identify rows in a table.
NOW , Al >
-
CBE <-
NM-Prime attribute

proper subset

Not a ,
Foreign Key references the primary key of another Table! It helps connect your Tables
Why do you need a foreign key?

Suppose, a novice inserts a record in Table B such as

You will only be able to insert values into your foreign key that exist in the unique key in the parent table. This
helps in referential integrity.

The above problem can be overcome by declaring membership id from Table2 as foreign key of membership id
from Table1

Now, if somebody tries to insert a value in the membership id field that does not exist in the parent table, an error
will be shown!

What are transitive functional dependencies?


A transitive functional dependency is when changing a non-key column, might cause any of the other non-
key columns to change

3NF (Third Normal Form) Rules

• Rule 1- Be in 2NF
• Rule 2- Has no transitive functional dependencies attribute
-Non prime
should not determine non-prime
attribute
.
To move our 2NF table into 3NF, we again need to again divide our table.

Table 1
Table 2
Table 3

We have again divided our tables and created a new table which stores Salutations.

There are no transitive functional dependencies, and hence our table is in 3NF

In Table 3 Salutation ID is primary key, and in Table 1 Salutation ID is foreign to primary key in Table 3

BCNF (Boyce – Codd Normal Form)


• The relation must be in 3NF.
• For every non-trivial functional dependency X -> Y in the relation, X must be a super key.
X

Left Hand side should be a super key

BCNF is a more stringent form of normalization compared to the third normal form (3NF).

A relation is said to be in BCNF if, for every non-trivial functional dependency (X -> Y) in the relation, X is a
superkey. Here, a non-trivial functional dependency means that Y is not a subset of X, and a superkey is a set of
one or more attributes that, taken together, uniquely identify a tuple in the relation.

4NF (Fourth Normal Form) Rules


BIKE MODEL
_
>>
-
MANUF _
YEAR

BIKE _ MODEL - COLOR

This can be read as "BIKE_MODEL multidetermined MANUF_YEAR" and "BIKE_MODEL


multidetermined COLOR".

For BCNF , Left Hand side of every FD must be


- 3 >
-

a
key .

For Option 1
,

For Option 3,
AB+ =
SABCDEY
ABT SABIDEY for option 2

X
(DE) ABT&ABCDEY:

*
For Option
4
e =
I B + SBEY
=

ABT LABCDEY

>
violates
BCN Condition
DA4 &

You might also like