I'm generally against using compound keys, except in join tables,
but I'm currently mapping out a schema where the join table has
child records. The application is for fund-raising and I have four
relevant tables:
tblPerson
tblOutreach -- the list of fund-raising actions/events (letters,
events, etc.)
To join these two tables, I have:
tblPersonOutrea ch
PK: PersonID + OutreachID
Joined to that is:
tblContribution s
PK: ContributionID
FK: ???
The question is:
Should I create a surrogate Autonumber in tblPersonOutrea ch to have
a single-field join between tblContribution and tblPersonOutrea ch,
or store the two fields of the compound key of tblPersonOutrea ch in
tblContribution ?
I would normally lean towards using the surrogate key
(tblPersonOutre achID), but in this case, I can see that it would be
quite common for me to want to display or print data from tblPerson
and tblContribution , or data from tblOutreach and tblContribution
(+tblPerson, in most cases). Storing the compound key means that I
could leave the join table out of the mix entirely.
Then it occurs to me that if I'm going to structure it this way,
maybe I should just collapse tblPersonOutrea ch and tblContribution
into a single table. It means that there won't be a proper 1:N
relationship between the Outreach action and the contributions it
generates, but, well, given that the vast majority of these outreach
actions will generate only one contribution per action, and given
that there's very little data in the join table, I'm not sure I see
any real benefit from maintaining the strictly correct normalized
structure.
I've got another app which is used for fundraising and it works
exactly the same way, with the two tables collapsed into one, and it
has never posed any kind of problem whatsoever. However, the
difference there is that in that application, a record is created
only when a contribution is received (i.e., they don't track
unsuccessful outreach actions), so it makes a great deal of sense to
collapse the two into one.
It actually would make UI design easier. On the other hand, I could
always use a flattened recordsource for me list of Outreach
events/contributions (I was originally considering using a simple
datasheet list with cascading datasheets to show the contributions).
Thoughts? Comments?
I'm really not seeing any benefit to having the join table as a
separate table, except for an exactitude in data modelling that has
no benefit that I can see of in an actual application.
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
but I'm currently mapping out a schema where the join table has
child records. The application is for fund-raising and I have four
relevant tables:
tblPerson
tblOutreach -- the list of fund-raising actions/events (letters,
events, etc.)
To join these two tables, I have:
tblPersonOutrea ch
PK: PersonID + OutreachID
Joined to that is:
tblContribution s
PK: ContributionID
FK: ???
The question is:
Should I create a surrogate Autonumber in tblPersonOutrea ch to have
a single-field join between tblContribution and tblPersonOutrea ch,
or store the two fields of the compound key of tblPersonOutrea ch in
tblContribution ?
I would normally lean towards using the surrogate key
(tblPersonOutre achID), but in this case, I can see that it would be
quite common for me to want to display or print data from tblPerson
and tblContribution , or data from tblOutreach and tblContribution
(+tblPerson, in most cases). Storing the compound key means that I
could leave the join table out of the mix entirely.
Then it occurs to me that if I'm going to structure it this way,
maybe I should just collapse tblPersonOutrea ch and tblContribution
into a single table. It means that there won't be a proper 1:N
relationship between the Outreach action and the contributions it
generates, but, well, given that the vast majority of these outreach
actions will generate only one contribution per action, and given
that there's very little data in the join table, I'm not sure I see
any real benefit from maintaining the strictly correct normalized
structure.
I've got another app which is used for fundraising and it works
exactly the same way, with the two tables collapsed into one, and it
has never posed any kind of problem whatsoever. However, the
difference there is that in that application, a record is created
only when a contribution is received (i.e., they don't track
unsuccessful outreach actions), so it makes a great deal of sense to
collapse the two into one.
It actually would make UI design easier. On the other hand, I could
always use a flattened recordsource for me list of Outreach
events/contributions (I was originally considering using a simple
datasheet list with cascading datasheets to show the contributions).
Thoughts? Comments?
I'm really not seeing any benefit to having the join table as a
separate table, except for an exactitude in data modelling that has
no benefit that I can see of in an actual application.
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Comment