I am currently building a databse scheme for a small company. But at the point doing it I figured out that my attept will be unacceptable due to the ability that one action will affect multiple unwated records.

To explain this. Currently I have one table addresses that links towards person, company, order etc.

The issue comes when we have a person that is linked to address ID 1, and a company address is linked to ID 1. And now when we want to change the company address - just one field like the building number from 5 to 6. The change will affect both the company and the person address - most likely all other attached to ID 1.

How should it be solved proffesionally - as the pro's build such scheme. My attept would be multiple address tables person_address, company_address etc. All would have the same fields which is not a optimal attempt I assume.

Thanks for any hints.

  • See the "Parties and Facilities" section of Enterprise Model Patterns (Hay). You can get a free trial on safaribooksonline to read it – Neil McGuigan Mar 31 '16 at 20:13
  • "most likely all other" - no, definitely all other. – Michael Green Mar 31 '16 at 21:18
  • Keep the address table as it is currently. The intersection tables, person_address etc., have just the foreign keys person_id and address_id. – Michael Green Mar 31 '16 at 21:20
  • well, I used now something like a is duplicate check, I will just go for 1 to 1 relation. So each address is a new address is that quite acceptable? – Kavvson Empcraft Apr 1 '16 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.