I am building my wife a Contacts Manager program as a fun exercise in learning Silverlight 4. It will track peoples Addresses, Phone Numbers, Emails, Special Occasions(Birthday, Anniversary, etc)
Along the way I hit a minor road bump while designing the Database. She would like to be able to group Contacts(people) by Family so I created a Families table that has FamilyID and FamilyDescription and then added FamilyID to table People.
Now SELECT * FROM People WHERE FamilyID = 2 would return everyone in that particular family.
I THINK this is an acceptable idea; where I am struggling, though, is how to incorporate children, as in kids. We have a very, very large family so there will be multiple kids per family. Do I just add them to table People, if so, how do I differentiate who the kids are from the adults?
I am very grateful for any insight, thanks.
The problem with the
PEOPLE.familyidis that it ensures a person can belong to only one family–ever. Which means if you wanted to differentiate between immediate and extended family, you’d be looking a hierarchical structure to associate the families when they aren’t necessarily hierarchical…The most accommodating solution would be to include a many-to-many table, so you could associate a
PEOPLErecord to any number ofFAMILYrecords:PEOPLE_FAMILY_MAP
PEOPLE.id)FAMILY.familyid)If you want to show relationships between people – you’d need a relationship type table (type_code, description), and associate relations using:
PEOPLE.id)PEOPLE.id)RELATIONSHIP_TYPE_CODES.RELATIONSHIP_TYPE_CODE)