Personally, I don't like any of your solutions, although the second solution is βfasterβ in terms of database theory. If you repeat addresses, they should be stored once.
The problem arises in implementation. When the order is placed, you have to decide whether you want to use the existing address, update the existing address (for example, with the apartment number added) or create a new address (the client has moved, has a new summer address, whatever).
To do this, someone (an employee for direct or telephone sales, a client or an online sales program) will have to decide whether you are updating the address or the operation of adding addresses. It is very difficult to get users to make this decision exactly. If the update is performed when the addition is really necessary, you have corrupted your order history (older orders point to a new address). If the addition is performed when the update was the right choice, you excluded the value of the normalized structure.
In such situations, I came, not very happily, to the conclusion that the best option is to save one or more addresses for the client, and then copy the address information into the address fields in the order that is needed.
If you choose your second option, you need to plan to write a really good user interface for the address system in order to avoid the problems that I mentioned above. And remember that not only you, but every programmer who works on the project in the future will need to understand and coordinate the management of this address table.
Larry lustig
source share