Third Normal Form Definition Transitive functional dependency – if there a set of attribute Z that are neither a primary or candidate key and both X Z and Y Z holds. By transitive functional dependency, we mean we have the following relationships in the table: A is functionally dependent on B, and B is functionally dependent on C. In this case, C is transitively dependent on A via B.
Consider the following example:
Example In the table above, [Book ID] determines [Genre ID], and [Genre ID] determines [Genre Type]. Therefore, [Book ID] determines [Genre Type] via [Genre ID] and we have transitive functional dependency .
3 rd Normal Form 3rd Normal Form Definition A database is in third normal form if it satisfies the following conditions: It is in second normal form There is no transitive functional dependency
To bring this table to third normal form, we split the table into two as follows:
Now all non-key attributes are fully functional dependent only on the primary key . In [TABLE_BOOK], both [Genre ID] and [Price] are only dependent on [Book ID]. In [TABLE_GENRE], [Genre Type] is only dependent on [Genre ID].
BCNF Boyce- Codd Normal form A relation is said to be in BCNF 1) If it is in 3NF 2) No dependency of an attribute of a multi attribute key on an attribute of another multi attribute key.
BCNF should have It should have multiple candidate keys i.e , more than one primary key. Composite candidate keys. No dependency of an attribute of a multi attribute key on an attribute of another attribute key i.e , overlapping.
Example Teacher_ID Department HOD Percent_time 100 Computers Vinod Kamboj 50 200 Maths S.S Sandhu 60 200 PHYSICS S. Prinja 40 300 History Armaan Kamboj 30 In the above table there are two composite keys Teacher_ID , Department Teacher_ID , HOD The above relation is in 3NF but not in BCNF because Department and HOD which are the part of composite keys are functionally dependant.
In order to normalize the relation into BCNF we have to create a new relation from old relation by breaking it. Teacher_ID Department Percent_time 100 Computers 50 200 Maths 60 200 PHYSICS 40 300 History 30 Department HOD Computers Vinod Kamboj Maths S.S Sandhu PHYSICS S. Prinja History Armaan Kamboj