=> What is normalization ?
Defination : Normalization is the process of efficiently organizing data in a database. There are two goals of the normalization process: eliminating redundant data (for example, storing the same data in more than one table) and ensuring data dependencies make sense (only storing related data in a table). Both of these are worthy goals as they reduce the amount of space a database consumes and ensure that data is logically stored. There are several benefits for using Normalization in Database.
- Eliminate data redundancy
- Improve performance
- Query optimization
- Faster update due to less number of columns in one table
- Index improvement
There are diff. - diff. types of Normalizations form available in the Database. Lets see one by one.
1. First Normal Form (1NF)
First normal form (1NF) sets the very basic rules for an organized database:
- Eliminate duplicative columns from the same table.
- Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key).
- Remove repetative groups
- Create Primary Key
|PK||[ Phone Nos ]|
2. Second Normal Form (2NF)Second normal form (2NF) further addresses the concept of removing duplicative data:
· Meet all the requirements of the first normal form.
· Remove subsets of data that apply to multiple rows of a table and place them in separate tables.
· Create relationships between these new tables and their predecessors through the use of foreign keys.
Remove columns which create duplicate data in a table and related a new table with Primary Key – Foreign Key relationship
3. Third Normal Form (3NF)
Third normal form (3NF) goes one large step further:
· Meet all the requirements of the second normal form.
· Remove columns that are not dependent upon the primary key.
4. Fourth Normal Form (4NF)
Finally, fourth normal form (4NF) has one additional requirement:
· Meet all the requirements of the third normal form.
· A relation is in 4NF if it has no multi-valued dependencies.
If PK is composed of multiple columns then all non-key attributes should be derived from FULL PK only. If some non-key attribute can be derived from partial PK then remove it
The 4NF also known as BCNF NF