Week 6
Week 6
A - > B En determines B4
I A determiss
uniquely B
means
RODNO -> S 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
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
.
key If .
not then take
of that with other
keyf
to chec if that is Candidate key
a
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
• Normalization divides the larger table into smaller and links them using relationships.
• The normal form is used to reduce redundancy from the database table.
• Ensuring the data dependencies make sense, that is, data is logically stored
• A normal form specifies a set of of conditions that the relational schema must satisfy in terms of its
• Most 3NF are free from insertion, update and deletion anomalies
Additional Normal Forms:
• Elementary Key Normal Form (EKNF)
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.
be
attached
-
can but
full name
K It in in
separate
Column .
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)
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
&
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?
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!
• 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 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.
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 &