## Vivek's SQL Notes

Vivek johari is currently a Analyst and have more that 5.5 yeras of experience in database. He has Master degree in Computer and also he is Microsoft certified Sql DBA (MCTS)& Microsoft certified SQl BI professional(MCTS). He is also Oracle certified profession(OCP)DBA in ORACLE 10g and ORACLE 9i.He has the experience of working in PL/SQL, T-SQL and SSIS/SSRS. His work basically involved designing and optimization of the Database.He has also published many database articles on his blog Technologies with Vivek Johari.

### Database Normalization

Normalization :- Normalization can be defined as the process of organization the data to reduce the redundant table data to the minimum. This process is carried out by dividing the database into two or more than two tables and defining relationship between them so that deletion, updation and insertion can be made to just one table and it can be propagated to other tables through defined relationships.

Normalization can be done for the following reason:-
1. To simplify the database structure so that it is easy to maintain.
2. To retrieve the data quickly from the database.
3. To reduce the need of restructuring the database when enhancement of the application required in future.

Normal Forms: - The normal form can be refers to the highest normal form condition that it meets and hence indicates the degree to which it has been modified. The normal forms are:-

1. First Normal Form (INF)
2. Second Normal Form (2NF)
3. Third Normal Form (3NF)
4. Boyce- Codd Normal Form
5. Forth Normal Form (4NF)
6. Fifth Normal Form(5NF)

Note: - Normalization into 5NF is considered very rarely in practice.

First Normal Form (INF):- A table is said to be in a First Normal Form (1NF) if it satisfy the below three conditions:-

1)      If the columns of the table only contain atomic values (Single, indivisible).
2)      Primary key is defined for the table
3)      All the columns of the table are defined on the primary key.

Second Normal Form (2NF):- A table is said to be in its Second Normal Form if it satisfied the following conditions:-

1) It satisfies the condition for the First Normal Form (1NF),
2) It do not includes and partial dependencies where a column is dependent only a part of a primary key.

Third Normal Form (3NF):- A table is said to be in the Third Normal form (3NF) if it satisfy the following conditions:-

1) It should be in the 2NF
2) It should not contain any transitive dependency which means that any non key column of the table should not be dependent on another non key column.

Denormalization:- Denormalization can be defined as the process of moving from higher normal form to a lower normal forms in order to speed up the database access.