Sunday, 8 October 2017

NORMAL FORM

What is Database Normalization?
Database normalization is the process of organizing data into tables in such a way that the results of using the database are always unambiguous and as intended.
First normal form (1NF). This is the "basic" level of database normalization, and it generally corresponds to the definition of any database, namely:
  • It contains two-dimensional tables with rows and columns.
  • Each column corresponds to a subobject or an attribute of the object represented by the entire table.
  • Each row represents a unique instance of that subobject or attribute and must be different in some way from any other row (that is, no duplicate rows are possible).
  • All entries in any column must be of the same kind. For example, in the column labeled "Customer," only customer names or numbers are permitted.

EXAMPLES OF TABLE IN 1NF
RULE

  • Each table cell should contain a single value.
  • Each record needs to be unique.

Second normal form (2NF). At this level of normalization, each column in a table that is not a determiner of the contents of another column must itself be a function of the other columns in the table. For example, in a table with three columns containing the customer ID, the product sold and the price of the product when sold, the price would be a function of the customer ID (entitled to a discount) and the specific product.
EXAMPLES 
RULE
  • Rule 1- Be in 1NF
  • Rule 2- Single Column Primary Key



Third normal form (3NF). At the second normal form, modifications are still possible because a change to one row in a table may affect data that refers to this information from another table. For example, using the customer table just cited, removing a row describing a customer purchase (because of a return, perhaps) will also remove the fact that the product has a certain price. In the third normal form, these tables would be divided into two tables so that product pricing would be tracked separately.
EXAMPLES 

RULE
  • Rule 1- Be in 2NF
  • Rule 2- Has no transitive functional dependencies




FOR FURTHER READING, GO HERE




0 comments:

Post a Comment

No insult and no Abuse