Here's the background:
Sales Agents sell insurance. They work alone or in an agency of 2 or more. When multiple agents work together, they need to split their commissions. The commission splits are predefined by percentages.
Example
Joe, John, and Saul belong to an agency.
For every policy sold Joe gets 40% of the commision, John gets 35%, Saul get 25%.
Every agent either works solo or is a member of one (and only one) Agency.
The obvious way to model this in the database is 3 tables: An Agents table, An Agency table and a AgencyCommissionSplits Table.
Agents table:
AgentID int PK
AgentName vchar(30),
AgencyID int FK Nullable
Agency Table:
AgencyID int PK,
AgencyName vchar(30)
CommissionSplits table:
AgencyID int FK,
AgentID int FK,
Percentage dec(3,1)
(compound PK AgencyID, AgentID)
The problem I see is I don't know how to insure that the percent totals for any given agency always totals 100%. I can try an enforce this in the front end, but I would really prefer a way in the database to enforce this constraint.