T
Tim Ferguson
A contact can be a single entity on its own or "belong" to any one or
combination of the following:
a single company -or-
a single division of a single company -or- multiple divisions of a
single company -or- a single division of multiple companies -or-
Multiple divisions of mutilple companies
PMFJI
I have tried to read as much of this thread as I could in one sitting:
can I propose a sub-typing kind of solution like this:-
ThingsToContact
===============
*Thing
OtherCommonStuff
Companies
=========
*Thing (FK references ThingsToContact)
FullName
TypeOfBusiness
Divisions
=========
*Thing (FK references ThingsToContact)
BelongsTo (FK references Companies)
AreaCovered
DollarsPerYear
MaxCreditAllowance
Addresses
=========
*AddressID
FirstLine
SecondLine
PostCode
PhoneNumbers
============
*PhoneID
AreaCode
LocalNumber
TypeOfPhone
LocatedAt
=========
*Thing (FK references ThingsToContact)
*Address (FK references Addresses)
*TypeOfLocation (eg mailing, billing, home, etc etc)
RingingAt
=========
*Thing (FK references ThingsToContact)
*Phone (FK references PhoneNumbers
*ReasonForPhoning (appointments, creditquery, etc)
People
======
*PersonID
FirstName
LastName
Birthday
WifesBirthday
Represents
==========
*Person (FK references People)
*Thing (FK references
*TypeOfContact (manager, salesman, etc etc)
I have a feeling that some of the PKs could be overly complex. For
example, I assumed that Eric can represent ACME division in different
roles at a time: but if this is not true then the PK for Represents needs
only to have the two fields. Etc further up the list.
Something like this can model most of your rules. Some of them need to
be implemented via CHECK constraints: for example ensuring that a
Company.Thing value does not appear in as a Division.Thing and so on. You
probably need controlling tables for TypeOfLocation, ReasonForPhoning etc
etc.
This also assumes that People don't have addresses or phone numbers
themselves, but are only addressable via the actual roles they assume: if
Eric is the salesman for Acme Division and regional rep for Southern
Belles, then you'd contact him using the appropriate details for either.
When it comes to UI design, it's simple enough to create a single list of
all the contacts he is associated with.
Hope that helps...
Tim F