Hi everyone, What is the main difference between first form normalizations and second form normalization ? In my opinion, they are both generated for the same operation which is to prevent redundancy(in other words; duplication of data in several records). So would you please explain it to me ?
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).
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.
1NF: If you have a table of users that stores their addresses, you don't want to have their addresses (street, city, state, etc) listed twice; i.e. their shipping and billing addresses are the same. So, move addresses to their own table and link with foreign keys. This reduces duplicate data PER ROW.
2NF: States can be repeated through rows, i.e. two people live in California. So, remove states from the addresses table and create a states table. Link addresses to states with foreign keys. This reduces duplicate data PER COLUMN.