What is this normalization? (moving duplicate data to a separate table)
I noticed that when designing a database, I try to move any duplicate datasets to a separate table. For example, let's say I had a table of people, each of whom lived in the state. Then I move these duplicate states to a separate table and reference them using foreign keys.
However, what if I don't store more state data. Then I will have a table with StateID and State in. Is this action correct? The state depends on the primary key of the users table, as well as transferring it to its own table using something?
Thank,
source to share
I believe that deleting subsets of duplicate data within a table and placing it in its own tables is caused by the process of placing the table in Second Normal Form .
Moving a state abbreviation into your own table is how you normalize your database. It protects your "user" table from update anomalies, where for some reason the KY abbreviation for Kentucky is updated to "KQ". By placing the foreign key in the custom table containing the primary key of the state table, you only need to make one update to the state table to correct this record for all of your users.
Thus, it seems clear to us that paragraph abbreviations often do not change. So if you know that your database will never need to store more state information, then it is logical and fundamentally great to leave the state field in the custom table. Plain de-normalization. This will increase the readability of the data in your custom table and reduce the overhead of performing the join. This is, however, a preference.
source to share
The state table should not have any key relationship with the user table, it should only contain state data.
What you might want to do to keep each table as simple as possible is to store the user data in the User table, the state data in the state table, and then create a join table that has a foreign key relationship to both the user and state tables.
As for the form of normalization, that is, I'm not sure.
source to share