What would be the best practice to store alternate names for entities and link them to a “master” record for rolling up data?
For example, I have a list of companies;
id name
1 Orange Kid Industries
2 Apple Kid Inc.
5 O.K.
Company 5 O.K. is an alternate name for 1 Orange Kid Industries. These companies need to be stored discreetly so that if a child record needs to be tied to 5 and not 1, (in the interest of storing historical data if the company name changed for instance,) it can.
I need to tie 5 O.K. back to 1 Orange Kid Industries as the “master” record so, when looking at all children of 1 Orange Kid Industries, I see all children of 1 and 5 combined.
I’m leaning toward a required master ID for all records. If a user creates a new company 6 Moldy Orange Kid Industries, he can assign it a master ID of 1 to signify that this is just another name for 1 Orange Kid Industries.
id name master
1 Orange Kid Industries 1
2 Apple Kid Inc. 2
5 O.K. 1
6 Moldy Orange Kid Industries 1
This seems to be the simplest route without requiring much redundant data. Are there any downsides to this approach?
That seems like a good solution to me. The only think I might change is to leave master null if a record is it’s own master. Probably not a huge deal, but seems like a potential infinite loop pitfall.