Sub-heading too or no sub-category? this is a quest

I would like to know what is the rule of thumb regarding subframes in a relational database?

For instance.

In the figure below, I replaced several fields with sub-tables, because for me there can be several instances with a limited number of instances

Is this a redundant or preferred way to design a database?

The second normal form (2NF) further considers the concept of removing duplicate data:

  • Follow all the requirements of the first normal form.

  • Delete the subsets of data that apply to multiple rows of the table and put them in separate tables.

  • Create relationships between these new tables and their predecessors using foreign keys.

enter image description here

PS I know that uuid is not INT and will change it.

+6
source share
1 answer

If in one table there will be more than one copy of the same data, a relationship should be formed. Duplicating data is difficult, and you leave a lot of room for errors.

As long as you do not have two references to the same data in the same table, you are safe.

Database normalization is the process of organizing fields and tables in a relational database to minimize redundancy.

See: Database Normalization

You are on the right track.

+1
source

Source: https://habr.com/ru/post/974143/


All Articles