I am creating a banking database and I have the following problem here.
Suppose CustomerA has an Account Number 4444 and through this I access all details related to the the customer I have a separate primary key but I generally query on this Account Number.
Now, for some reason the Account Number of CustomerA is changed from 4444 to 5555 and a new CustomerB is given the Account Number 4444.
I want my database to handle such a change, what approach should I apply?
Approaches I developed are: assigning a timestamp with the account number, this will help me to query efficiently to find out the current Account Number related Customer Name.
But I cannot design a query in which:
- When I access CustomerB using 4444 only the current details related to B appear and not the one's 4444 is pointing for CustomerA, and
- CustomerA when being accessed by 5555 shows all details including the one's which are being stored in the database by 4444