R
R
Romi2021-06-03 23:06:50
Database design
Romi, 2021-06-03 23:06:50

Can you explain what fourth normal form is in a way that is easy to understand?

Wiki article: https://ru.wikipedia.org/wiki/%D0%A7%D0%B5%D1%82%D... I don't understand :-)

You can somehow use a simple example without composite keys ( I don't usually use them at all.

Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
grebenyukov, 2021-06-12
@romicohen

In the wikipedia example, imagine you have a table with restaurants, a table with types of pizza, and a table with delivery areas. Now you need to put objects in the database schema to indicate: a) in which restaurant which type of pizza is produced and b) from which restaurant to which area you can deliver. In the example, 2 options are considered - 1) a table with fields (restaurant_id, pizza_type_id, delivery_area id) and 2) two tables, one with fields (restaurant_id, pizza_type_id) and the second with fields (restaurant_id, delivery_area_id) - and it is described why the first option is not in 4NF. The bottom line is that with the first implementation in the database, there may be cases when some of the restaurants can deliver some types of pizza to a certain area, while other types of pizza cannot. In addition, when adding a new type of pizza, it is not enough to create 1 table element in the directory and 1 element in the link table, but you need to do this for all delivery areas. And then another case is considered, when the price of pizza is determined as a function of the restaurant, type of pizza and delivery area (apparently, in this example, the cost of delivery is included in the cost of pizza). For this case, due to the presence of a functional dependency, the price table will have an alternative key of three fields as in example 1) and this will no longer be a violation of 4NF.
You may choose not to use primary composite keys. However, a more or less complex system will most likely have entities with composite alternative keys - if such a key is not made, logical duplicates are possible, a composite alternative key in the form of a constraint or a unique index will save you from this. For example, when there are 2 or more rows in the relationship table between restaurants and types of pizza with the same set of values ​​(restaurant_id, pizza_id).

R
Rsa97, 2021-06-03
@Rsa97

How can one explain a concept based on composite keys without composite keys? Yes, and the wiki seems to chew everything in detail.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question