Reputation: 919
I need to design a relational DB that will bulk load customer/address data based on periods like Q1, Q2 etc. I am looking to create a simple customer master table that includes demographics such as address. The challenge is that customer addresses MAY change over periods and I need to capture these new addresses and also retain older addresses as a snapshot for earlier periods.
I could easily make customerId/quarter the unique traits for each row but that would cause many unneeded duplicates for customers with addresses that remain the same. Another option could be to make the default quarter be 'ALL' and only add new rows for existing customers with address updates. It would then be up to the query/view to select 'ALL' unless the specified quarter exists (indicating an updated address)
Not sure the optimal approach for such a scenario and I was hoping someone else might have some suggestions?
Upvotes: 0
Views: 602
Reputation: 1352
I would suggest a design like this:
This allows for several things:
Your queries could join these tables together and filter based on the valid dates inside the customer_address table.
Does all of that make sense?
Upvotes: 1