I've crossed this problem in, oh, every application I've ever written. I'd like a final consensus answer!
Is this the most normalized/efficient/proper way to store contact methods or any other data along this pattern in a database?
Contact { PK ContactId, ... }
ContactContactMethod {PK FK ContactId, PK FK ContactMethodId, Key, Comments }
AddressContactMethod {PK FK ContactMethodId, Line1, Line2, City, State, Zip }
EmailContactMethod {PK FK ContactMethodId, EmailAddress }
InstantMessengerContactMethod {PK FK ContactMethodId, IMClient, IMAddress }
PhoneContactMethod {PK FK ContactMethodId, ... }
WebsiteContactMethod {PK FK ContactMethodId, ... }
OtherContactMethod {PK FK ContactMethodId, ... }
Should I consider an Xml field for ContactMethodData
on the ContactContactMethod
table instead?
Something just feels wrong about AddressContactMethod, EmailContactMethod, etc all sharing the same uniqueness of primary keys.
Also thought about a key, value pair for contact data, but that would be even more of a pain to query than the Xml field.
(Design guidelines: each contact may have more than one or none of each type of contact method, each with a non-unique "key" like "home, work, red car, etc" and comments but no other shared data elements between types)