Normalization
Normalization
Deletion Anomaly : If (S_id) 401 has only one subject and temporarily he drops
it, when we delete that row, entire student record will be deleted along with it.
Normalization
There is a sequence to normal forms:
1NF is considered the weakest,
2NF is stronger than 1NF,
3NF is stronger than 2NF, and
BCNF is considered the strongest
Also,
any relation that is in BCNF, is in 3NF;
any relation in 3NF is in 2NF; and
any relation in 2NF is in 1NF.
Normalization
1NF a relation in BCNF, is also
in 3NF
2NF a relation in 3NF is also in
2NF
3NF
a relation in 2NF is also in
1NF
BCNF
Normalization of Database
We consider a relation in BCNF to be fully normalized.
The benefit of higher normal forms is that update
semantics for the affected data are simplified.
This means that applications required to maintain the
database are simpler.
A design that has a lower normal form than another
design has more redundancy. Uncontrolled redundancy
can lead to data integrity problems.
EmpNum EmpEmail
DeptNum DeptName
InvNum InvDate
EmployeeDept
ename ssn bdate address dnumber dname
dnumber dname.
Third Normal Form
• A relation is in 3NF if the relation is in 1NF and all determinants of non-key
attributes are candidate keys
That is, for any functional dependency: X Y, where Y is a non-key
attribute (or a set of non-key attributes), X is a candidate key.
• This definition of 3NF differs from BCNF only in the specification of non-
key attributes - 3NF is weaker than BCNF. (BCNF requires all determinants
to be candidate keys.)
BC
NF
student_no instr_no
course_no instr_no
The Primary key is usually a single column, but sometimes more than one
column can be combined to create a single primary key. For example consider
a table which is not in First normal form
Second Normal Form (2NF)
As per the Second Normal Form there must not be any partial dependency
of any column on primary key. It means that for a table that has
concatenated primary key, each column in the table that is not part of the
primary key must depend upon the entire concatenated key for its
existence. If any column depends only on one part of the concatenated key,
then the table fails Second normal form.
In example of First Normal Form there are two rows for Adam, to include
multiple subjects that he has opted for. While this is searchable, and follows
First normal form, it is an inefficient use of space. Also in the above Table in
First Normal Form, while the candidate key is {Student, Subject}, Age of
Student only depends on Student column, which is incorrect as per Second
Normal Form. To achieve second normal form, it would be helpful to split
out the subjects into an independent table, and match them up using the
student names as foreign keys.
Third Normal Form (3NF)
Third Normal form applies that every non-prime attribute of table must
be dependent on primary key, or we can say that, there should not be
the case that a non-prime attribute is determined by another non-
prime attribute. So this transitive functional dependency should be
removed from the table and also the table must be in Second Normal
form. For example, consider a table with following fields.
http://www.studytonight.com/dbms/database-normalization.php
http://beginnersbook.com/2015/05/normalization-in-dbms/
In Bengali..
http://subeen.com/%E0%A6%A8%E0%A6%B0%E0%A6%AE%E0%A6%BE%E0%A6%B2%E0%A6%BE%E0%A6%87%E0%A6%9C%E0%A7%8
7%E0%A6%B6%E0%A6%A8
%E0%A6%A1%E0%A6%BE%E0%A6%9F%E0%A6%BE%E0%A6%AC%E0%A7%87%E0%A6%9C/
What you have learn from this
lecture?
48