Understanding Table Normalization

Asked 2 years ago, Updated 2 years ago, 417 views

I've been designing DB tables so far, and I always get lost.
It's about whether the name should be on the transaction table.
Generally, it is good to code names and manage them centrally in a master table, but if you have a company name in the master and change the name in the master, it will be displayed as a new company name when you display past transaction information.Originally, it should be displayed by the company name at that time.In response to this case, we see a table design that has both the company code and the company name in the transaction table, but I feel that this is not normalized and does not make sense to code.
Another idea is that if the name changes, you can treat it as a different company and add new records to the master, but I think it's complicated because users have to look like they're the same company.
I always wonder what the best solution is, but how is it going?

database database-design

2022-09-30 21:56

2 Answers

Originally, it should be displayed by the company name at that time

Whether or not you should depends on your business requirements.

  • See only current information
  • Only the name should be at that time
  • Requires multiple information at that time
  • It must be stored accurately, including not only the information but also the relationship to the master information at that time

What the "best solution" is depends on your requirements.If you don't think about it first, the "best solution" doesn't actually meet the requirements, or the "best solution" requires meaningless complexity and slow processing of the requirements.


2022-09-30 21:56

"If the ""Company"" master column is ""Company Code,"" ""Company Name,"" and ""Number of editions,"" it can be used to change the company name without changing the ""Company Code."""
If the table has meaning as a record, it is considered the company name at that time, and the company name is not subject to centralized management.
If you also need your current company name, you can always get the latest company name by having the company code.


2022-09-30 21:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.