P
P
PetrW2016-07-09 11:38:21
Database
PetrW, 2016-07-09 11:38:21

How is the second form of normalization different from the third?

I read several articles on Habré and finally got confused in the second and third forms of normalization.
For example, here https://habrahabr.ru/post/254773/ there are phrases that the
second form says that "each non-key attribute irreducibly depends on the Primary Key"
the third form "requires to take out all non-key fields, the contents of which may refer to multiple table entries in separate tables."
Isn't it the same thing?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2016-07-09
@PetrW

Third normal form does not allow transitive dependencies.
Let's say we have a car dealership database. There is a relationship Автомобиль(СерийныйНомер, Модель, Цена). There is a dependency СерийныйНомер -> Модель(that is, for each car, we always know exactly the model of this car). Also, since we have a branded car dealership, and not a sale of used cars, the price of a car depends only on its model (i.e., all new cars of the same model will cost the same, we do not take any configuration into account). Those. there is a dependency Модель -> Цена.
Because by the serial number we can determine the model, and by the model - the price, then the price also depends on the serial number:СерийныйНомер -> Цена. However, this dependence is transitive: the price does not depend directly (!) on the SerialNumber, but on the Model. Therefore, this relation is not in third normal form (although it is in second normal form). To bring a relation into 3NF, it must be divided into two - МодельАвтомобиля(СерийныйНомер, Модель)and ЦенаМодели(Модель, Цена).
It should be noted that if the subject area would define other dependencies, then the considered relation could be in another NF. For example, if we still sold used cars, and we set the price for each of them separately, then there would be no dependence Модель -> Цена, but there would be a direct (non-transitive dependence) СерийныйНомер -> Цена, and the ratio would fit the criteria of the third normal form.

A
Alexey Ukolov, 2016-07-09
@alexey-m-ukolov

https://ru.wikipedia.org/wiki/Second_Normal_Form
https://ru.wikipedia.org/wiki/Third_Normal_Form
Everything should be clear from the examples.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question