3 Normal Forms

First Normal Form:
A Table is said to be in 1 NF if it follows below 2 conditions.

1) Table data should be atomic in nature
2) No Repeating groups of data
Second Normal Form:
1) Be in 1 NF
2) Have No partial
functional dependency.
(i.e. non key column is dependent on the part of the composite primary key)
if you have partial functional dependency you will have repeated data in table
ex: (PK-toy_ID,store_ID)
toy_ID Store_ID color inventory store_address
5 1 white 34 23 Maple
5 3 yellow 5 100 E. North St.
6 1 white 7 23 Maple

store_address has partial functional dependency on store_ID
If store_address is changed we have to update all the entries whereever it is existed. data is repeated. Lot of records we have to update.

Your 1 NF table is also 2NF if all the columns in the table are part of the primary Key (or) it has a single primary Key

Third Normal Form:
1) Be in 2NF
2) Have no transitive dependencies
transitive functional dependency: any non-key column is related to any of the other non-key columns.

if changing any of the non-key column might cause any of the other columns to change, you have a transitive dependency.
ex: (PK-course_ID)
course_ID course_name instructor instructor_phone
Observation:
1) if we change the course_name neither instructor nor instructor_phone need to change.
2) if we change the instructor_phone, neither instructor nor course_name needs to change.
3) if we change the instructor, the instructor_phone will change. we've found our transitive dependency.

No comments:

Post a Comment