This is “what is the best practice” question.
I have 3 tables: orders, customer and address.
Order
------
ID
ADDRESS_ID
Customer
------
ID
Address
------
ID
CUSTOMER_ID
IS_HIDDEN
User can have multiple address and is free to edit them at any time. When user places an order I need to store a “snapshot” of his address at that time, associate it with the order and make it unavailable to the user. In other words, I want to duplicate address row which will be owned by Order table instead of Customer. This ownership needs to be somehow indicated (for example with IS_HIDDEN flag).
Is this correct approach that some data from address table is sometimes “owned” by a Customer table and sometimes by “Order”?.
The other solution would be replicating all columns from Address table in Order so the ownership will be explicit but I have bad feelings about duplication in schema.
If you really want a snapshot of the address you should probably store the address in the order, not a separate table.
You would be making your queries and data unnecessarily complicated.
And with the implementation you are describing you would get duplication anyway.
Example:
The final result would be: