This issue has always proven to be a challenge to me when designing a relational databases: Types
For example: You are entering in data for a person: Name Address, etc. Each Person is of a Certain “Type” (‘Friend’ or ‘Co-Worker’ for example). In this case, to keep it simple, each person can only be of a single type. A Friend type might have: hobbies, interests, birthdate, wedding anniversary, etc. while a Co-Worker type might have a completely different set of items: Work days, hobbies, married, etc. Note that the datatypes for each item may change. Some may be Boolean, others dates and still others, simple text. Based on the Type chosen for the person, I want to enter in information for each item, specific to that type of person.
Real challenge: I want to be able to add new Types of people without modifying my data structures and new Items that correspond to each type. Then enter data for item for each person of that type.
So for example:
Andy Andrews is of Type: “Friend”. When I specify that in the UI, I will see the different items that are specific to a “Friend” and it will allow me to enter in data for each of those items for Andy: Hobbies, birthdate, Wedding anniversary, etc.)
Sally Smith is of Type: “Co-worker” When I specify that in the UI, I will see different items that are specific to a “Co-worker” and it will allow me to enter in data for each of those items for Sally: Work days, hobbies, married, etc.
The real trick is that Later on, without modifying the Structure of my database, I want to be able to add a new Category: “Relative”, specify items specific to a “Relative” (Relationship, Age, etc.)
Fred Ferguson is of Type: “Relative” and I should now be able to enter and store information about his Relationship and Age.
I can figure out the UI if I can get the RDBMS structure correct. So, what type of structure would you use to accomplish this goal in a Relational Database? In other words, how would you structure your data tables and relationships to support this desired goal?
Thank you in advance, for your thoughts and comments.
P.S. – All names and examples are fictional. Any similarities between these names and real people is purely coincidental.