Docsity

Database Management System Lecture: Second and Third Normal Forms and Anomalies, Slides of Introduction to Database Management Systems

Partial preview of the text

Download Database Management System Lecture: Second and Third Normal Forms and Anomalies and more Slides Introduction to Database Management Systems in PDF only on Docsity!

Database

Management

System

Lecture - 20

Second Normal Form

A relation is in 2 nd^ normal form iff

it is in the first normal form and all

non key attributes are fully

functionally dependent on key, that

is, there is no partial dependency

Anomalies

Redundancy

Insertion Anomaly

Deletion Anomaly

Updation Aomaly

Anomalies

crId stId stName fId room grade

C3456 S1020 Suhail Dar F2345 104 B

C5678 S1020 Suhail Dar F4567 106

C3456 S1038 Shoaib Ali F2345 104 A

C5678 S1015 Tahira Ejaz F4567 106 B

Second Normal Form

Each of these tables is in second

normal form

Free of anomalies due to partial

dependency

Third Normal Form

A table is in third normal form

(3NF) iff it is in 2NF and there is

no transitive dependency, that is,

no non-key attribute is dependent

on another non-key attribute

Anomalies

stId stName stAdr prName prCrdts

S1020 Sohail Dar I-8 Islamabad MCS 64

S1038 Shoaib Ali G-6 Islamabad BCS 132

S1015 Tahira Ejaz L Rukh Wah MCS 64

S1015 Tahira Ejaz L Rukh Wah MCS 64

S1018 Arif Zia E-8, Islamabad. BIT 134

Third Normal Form

STD(stId, stName, stAdr, prName, prCrdts)

stId  stName, stAdr, prName, prCrdts

prName  prCrdts

STD (stId, stName, stAdr, prName)

PROGRAM (prName, prCrdts)

Boyce-Codd Normal Form

A general form of 3NF

Every relation in BCNF is in 3NF

vice-versa is not always true

3NF is checked in steps, BCNF

checked directly

BCNF

A table is in BCNF if every

determinant is a candidate key

Situation when table in 3NF is not

in BCNF

A non-key determines a part of

the composite primary key

BCNF

We decompose the table again to

bring it into BCNF

FACULTY (fId, dept, office, rank, dateHired)

FACULTY(fId, office, rank, dateHred)

OFFICE(office, dept)

Higher Normal Forms

After BCNF fourth, fifth and domain-key

normal forms exist

4NF deals with multivalued dependency,

fifth deals with possible lossless decompositions, DKNF reduces further chances of any possible inconsistency