Pergunta

I am trying to understand Normalization. I have followed a couple of Youtube tutorials and also watched Lynda tutorial. I have understand a bit about normalization but still i have few questions. 1) 1NF is used to avoid repeating groups and repeating values, but when i shift data of table1 to table2, table1 doesn't have any repeating values, but table2 does have.Why is that so? Secondly i don't understand much about 2NF, kindly tell me the difference between 1nf and 2nf?

I understand 3NF, we used it to put Non-Keys values in some other table.

Kindly tell me that what i have understand is correct or not? and resolve my problems Thanks.

Foi útil?

Solução

When you convert from 1NF to 2NF, the repeating values in the new table should only be foreign keys into the original table. Take a look at the first example in the Wikipedia entry. In the 1NF table, Current Work Location is repeated with each Employee, even though it's dependent only on the Employee, not the entire {Employee Skill} primary key. In the 2NF version, there's an Employee table, where Current Work Location does not get repeated. In the Employees Skills table employees are repeated because they can have multiple skills.

The benefit of 2NF is that when you change a value that's dependent on only a subset of the key (e.g. an employee changes locations) you only have to change one row. In the original table in the Wikipedia example, if an employee changes locations you would have to change all the Employees Skills rows with that name (and if you have other tables that are similarly denormalized, you'd have to update them as well).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top