all groups > sql server programming > october 2004 >
You're in the

sql server programming

group:

Modeling Contact Information


Modeling Contact Information dsellers
10/4/2004 9:13:03 PM
sql server programming:
I am working on a database that is going to store contact information. I am
trying to normalize this area quite a bit because I want multiple object
types to be able to have the same address.

I have built a Company Entity and a Employee Entity. I also have
ElectronicAddress and PhysicalAddress Entities. These are related with a
Object_has_ContactInformation Relationship.

Company
=======
1 Microsoft
2 Apple

Employees
=========
23 BillG
2 SteveJ

PhysicalAddress
===============
8 1 Apple Way
99 56 Microsoft Lane

Object_has_ContactInformation
=============================
Object, AddressId
2 8

The problem is that this table has duplicates are we using a company (Apple)
or an Employee (steveJ). How should I best handle this? Do I add a key
ObjectType into Object_has_ContactInformation?

Object_has_ContactInformation
=============================
ObjectId, ObjectType, AddressId
2 Company 8

That would help. Or do I create a table that handles the Keys
ContactInformationRegistry? Then use these keys to associate with the
ContactInformation.

ContactInformationRegistry
==========================
Key, ObjectId, ObjectType(?)
1 2 Company

Registry_has_ContactInformation
=============================
RegistryId, AddressId
2 8

I am sure that I am way off base, but I would love to hear more ideas on the
RE: Modeling Contact Information John Bell
10/4/2004 11:49:01 PM
Hi

Creating a superset of "objects" that contains the ids for all
companies/employees would give a unique key in both the company and employee
table. This could then be used in the linking table between objects and
addresses. Usually the address Id is stored against company/employee/contact.

John

[quoted text, click to view]
AddThis Social Bookmark Button