0

I will explain the problem with an example: I am designing a specific case of referential integrity in a table. In the logical design there are two tables, enterprise and document. We register the companies and then someone inserts the documents associated with it. The name of the enterprise is variable.

When it comes to recovering the documents, I need the name value of an enterprise to be the same as it was when it was registered and not the value it currently has.

The solution that I thought was to register the company again in each change with the same code, the updated name in this way would have the expected result, but I am not sure if it is the best solution. Can someone make a suggestion? enter image description here

1
  • 1
    Why are you using numeric(19,0) instead of bigint?
    – McNets
    Jan 24, 2019 at 18:14

1 Answer 1

2

I'd simply store the register_name (meaning the first value that was taken by the name of the enterprise) in the enterprise table :

  • identerprise
  • code
  • name
  • register_name

Then I think you shouldn't use varchar(n) to store your text value (see that documentation page)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.