One-To-One Tables

O

oldblindpew

This may prove to be an open-ended question, but here goes. I'm anticipating
having three tables with one-to-one relationships back to another table. All
of this information could therefore be placed in one massive table, but
somehow I feel it would be more manageable if separated. The question is,
should I key all three tables back to the main table, or should I key the
main to the first, the first to the second, and the second to the third?
Does it matter?

More info: The main table is Agreements. The sub-tables are Requirements,
Certificates, and Validations. Each Agreement imposes a set of Requirements.
A Certificate lists what is being offered to meet those Requirements, and a
Validation checks what is being offered against what is being required, field
by field.

So you could say Agreements result in Requirements, which result in
Certificates, which result in Validations. Or, you could say for each
Agreement there is a Requirement, a Certificate, and a Validation. There is
truth in both statements as all of these are interrelated. I'm just afraid
this will be another one of those cases where you have a choice, and it
doesn't really seem to matter, but one day long afterwards you find out that
despite all your caution you made the wrong choice.
 
J

Jerry Whittle

Seems to me if an Agreement imposes a set of Requirements, then you have a
One-to-Many relationship. Is this correct? Hopefully you aren't putting
Requirements in a table with fields something like Req1, Req2, and so on.
 
J

John W. Vinson

This may prove to be an open-ended question, but here goes. I'm anticipating
having three tables with one-to-one relationships back to another table.

One to one relationships are VERY rare. See below.
All
of this information could therefore be placed in one massive table, but
somehow I feel it would be more manageable if separated. The question is,
should I key all three tables back to the main table, or should I key the
main to the first, the first to the second, and the second to the third?
Does it matter?

If the reality is that there is a "master" table and two "Child" tables, then
relate each child to the master. If the third table logically relates to data
in the second table, then cascade. It depends on the logical structure of the
data.

More info: The main table is Agreements. The sub-tables are Requirements,
Certificates, and Validations. Each Agreement imposes a set of Requirements.

But a one to one relationship implies that an Agreement can have zero or one
Requirement, never more. Are you perhaps using one *FIELD* per requirement? If
so you're not normalized.
A Certificate lists what is being offered to meet those Requirements, and a
Validation checks what is being offered against what is being required, field
by field.

Not record by record, using a one to many relationship?
So you could say Agreements result in Requirements, which result in
Certificates, which result in Validations. Or, you could say for each
Agreement there is a Requirement, a Certificate, and a Validation. There is
truth in both statements as all of these are interrelated. I'm just afraid
this will be another one of those cases where you have a choice, and it
doesn't really seem to matter, but one day long afterwards you find out that
despite all your caution you made the wrong choice.

Just be sure you don't have repeating groups, to start with! Perhaps you could
post (real or hypothetical) sample data and indicate the field structures of
your tables.
 
O

oldblindpew

Thanks for your reply. I don't think the one-to-many is correct. It is true
that one Agreement imposes many requirements, however, the requirements
consist of a standard set of categories. There will be a set group of fields
making up the Requirements Table, with the values in those fields varying
from one Agreement to the next.

This is really about subcontractor's insurance, but to simplify, let's say
we're talking about furnishing cars. One Agreement may require a Yellow,
2-door, Chevy. Another Agreement may require a Red, 4-door, Ford. The
Requirements table would have fields for Color, Number of Doors, and Make.
Field values would be dictated by each Agreement. A Certificate would be
furnished describing the actual car being offered in fulfillment of the
Agreement. The Validation would show how close a match was achieved between
the Requirement and the Offering.
 
O

oldblindpew

Thanks for your reply. See also my response to Jerry Whittle.

This is about Certificates of Insurance furnished by subcontractors. Much
of my design is driven by the standard certificate form commonly seen in the
industry. This certificate form has lots of fields on it, and in order to
validate the certificate, each field has to be checked. My approach has been
to create one table for the certificate information and another similar table
to store the results of the validation, if ever I can get there.

To check or validate the certificate, there must be requirements to check
against. Originally I had a third table consisting of three records defining
three standard sets of insurance requirements, because we took sort of a
"Small, Medum, Large" approach to our requirements. Each Agreement pointed
to one of these three standard sets of requirements. But since it is
possible for any given agreement to modify or waive any given insurance
parameter, it seems better to let each agreement have its own unique set of
insurance requirements. Thus I arrive at three tables each relating back to
the Agreements table in a one-to-one fashion.

In order to ease the task of establishing the insurance requirements for
each agreement, I'll need to figure out how to enable the user to copy a
requirements record from one of the three standards, or from an existing
agreement, and then make whatever modifications may be called for by the
Agreement.

I appreciate your taking time to consider this and offer advice on whether
it matters how the tables are linked. Or that the whole effort would be
better served by a totally different approach. --Thanks, OBP
 
J

John W. Vinson

Thanks for your reply. See also my response to Jerry Whittle.

This is about Certificates of Insurance furnished by subcontractors. Much
of my design is driven by the standard certificate form commonly seen in the
industry. This certificate form has lots of fields on it, and in order to
validate the certificate, each field has to be checked. My approach has been
to create one table for the certificate information and another similar table
to store the results of the validation, if ever I can get there.

To check or validate the certificate, there must be requirements to check
against. Originally I had a third table consisting of three records defining
three standard sets of insurance requirements, because we took sort of a
"Small, Medum, Large" approach to our requirements. Each Agreement pointed
to one of these three standard sets of requirements. But since it is
possible for any given agreement to modify or waive any given insurance
parameter, it seems better to let each agreement have its own unique set of
insurance requirements. Thus I arrive at three tables each relating back to
the Agreements table in a one-to-one fashion.

In order to ease the task of establishing the insurance requirements for
each agreement, I'll need to figure out how to enable the user to copy a
requirements record from one of the three standards, or from an existing
agreement, and then make whatever modifications may be called for by the
Agreement.

I appreciate your taking time to consider this and offer advice on whether
it matters how the tables are linked. Or that the whole effort would be
better served by a totally different approach. --Thanks, OBP

I think it WOULD be better served by a totally differnent approach - a
normalized Access database. <g>

It sounds very much to me like you have a very straightforward Many to Many
relationship between Certificates and Requirements. Each certificate has many
requirements; each requirement may occur on many Certificates.

You're solving the problem using spreadsheet logic: one field (column) for
each requirement. This is not ideal in Access! If your "Small" template has
(say) seventeen requirements, then you could have seventeen *RECORDS* in a
CertRequirements table, linked to this particular subcontractor's certificate,
and to a table of all the possible requirements that might arise (seventeen of
them from seventeen different records, in this instance). This would let you
add new requirements, waive individual requirements, add modifying notes or
comments to a requirement, etc. etc.
 
O

oldblindpew

I'm sorry, but I don't know who you are or what responses your are referring
to.
--OBP
 
J

Jerry Whittle

I agree with John's response. One thing that I'll add is what happens to all
your forms, reports, and queries when someone adds to the standard set of
categories? They will all need to be redesigned. It's better to plan for such
possible changes in your design now than to deal with them piecemeal in the
future.
 
J

John W. Vinson

You got three initial responses, Jerry, myself (Steve) and John.

I think you may have propagation problems, Steve: your response did not make
it to my server (and probably not to oldblindpew's either).
 
O

oldblindpew

Thanks for replying, John, and you are correct about Steve. I already stated
that I don't know who he is or what response he is referring to, so it should
be abundantly clear that I never saw his inital message.

I believe I understand what you are saying about normalization and
many-to-many relationships, in order to avoid saving the same values
repeatedly, as in a spreadsheet, and in order to avoid the age old problem of
discovering that you didn't put enough columns, or the correct columns, in
your table. However, I also know there are cases, as with Postal Codes,
where the benefits of normalization are not worth the trouble, and I am still
wrestling with that question here.

I want to make sure you are taking into account that it isn't just a simple
matter of a many-to-many relationship between Certificate and Requirement.
The Agreement dictates the Requirement set. The Certificate, on the other
hand, provides a set of what might be called Offerings in response to the
Requirements. Wouldn't I need a Agreement/Requirement join and a
Certificate/Offering join? Once I got that done, I'd need a way to compare
these two joins to see if the Offerings of the Certificate satisfy the
Requirements of the Agreement. I'm afraid I'll get so tangled up with
cross-references that it won't be worth the trouble.

I'm sorry for this half-baked response, but I didn't want to wait too long
to reply. I'm also finding that the reference books I'm using aren't all
that helpful. Their discussions of many-to-many relationships seem a bit
sketchy.
--OBP
 
O

oldblindpew

Nope. Steve said I got three initial responses to my question, one from
Jerry, one from Steve and one from John. I see only Jerry's and John's.
--OBP
 
O

oldblindpew

Thanks, Steve, we meet at last. In my reply to Jerry I posed an analogy to
furnishing automobiles. One Agreement might specify that a Yellow, 2-door,
Chevrolet be furnished. "Yellow", "2-door", and "Chevrolet" would be
examples of Requirements. The list of requirements could obviously go on and
on. Therefore, yes, one Agreement has many requirements, however, any one
Requirement may be equally applicable to more than one different Agreement,
so strict normalization would require, as Jerry and John suggested, a
many-to-many relationship between Agreements and Requirements.--OBP
 
O

oldblindpew

John, Jerry, Steve:

I THINK I'VE GOT IT!! It came to me last night driving home from work. I
need the Agreements table and the Requirements table in a many-to-many
relationship, with the Certificates table serving as the junction table. But
since the Requirements table will actually do double duty as providing both
insurance requirement values and certificate offering values, I will refer to
it as the Insurance Parameters table instead.

TblAgreements
AgreementID
<Agreement fields>

TblInsParameters
InsParameterID
InsParameterDescrip
<Other fields, if any>

TblCertificates
CertificateID
AgreementID
InsRequirementID (same as InsParameterID)
InsOfferingID (same as InsParameterID)

So if the InsOfferingID and the InsRequirementID match, then the Certificate
is valid for that one particular parameter.

Now, it is not clear from my reference books whether a junction table must
use a composite primary key consisting of values that match the primary keys
from the two joined tables, or, whether you are free to use a separate
primary key. I hope the latter is the case, because I've grown prejudiced
against composite keys.

I wasn't sure where in the thread to put this posting, so I put it here in
hopes you all find it. Thanks for your suggestions, and I would appreciate
any further suggestions, corrections or advice you may have to offer on this
plan of attack. I'm sure as I get on with this there will be plenty of
unforeseen obstacles to negotiate.
--OBP
 
J

John W. Vinson

Now, it is not clear from my reference books whether a junction table must
use a composite primary key consisting of values that match the primary keys
from the two joined tables, or, whether you are free to use a separate
primary key. I hope the latter is the case, because I've grown prejudiced
against composite keys.

You can indeed put in an autonumber primary key as a surrogate; I would
recommend putting a unique Index on the combination of the two fields to
prevent inadvertant duplicates.

Glad you got it working.
 
O

oldblindpew

Well, it isn't working yet, but at least I have a plan, thanks largely to
you. If you hadn't replied to my original question, I would probably still
be thinking of this like a spreadsheet, which might have proven functional,
but not optimal. I will pay close attention to your advice about the Index,
also. Thanks again and again!
-OBP
 
D

David W. Fenton

Now, it is not clear from my reference books whether a junction
table must use a composite primary key consisting of values that
match the primary keys from the two joined tables, or, whether
you are free to use a separate primary key. I hope the latter is
the case, because I've grown prejudiced against composite keys.

I would never use a surrogate key in a join table unless there were
tables related to the PK of the join table. For instance, if you
have a junction table between person and employer and you need to
have multiple titles for each of the records in the junction table,
then you'd need to store the junction table's PK in the storing the
position titles.

tblPerson PK PersonID
tblCompany PK CompanyID
tblPersonCompany PK PersonID+CompanyID, FK PersonID, FK
CompanyID tblTitle PK TitleID, FK PersonID+CompanyID

versus

tblPerson PK PersonID
tblCompany PK CompanyID
tblPersonCompany PK PersonCompanyID, FK PersonID, FK CompanyID
tblTitle PK TitleID, FK PersonCompanyID

But this is what I consider an unusual case. It's very seldom that
you need a many-to-one relationship beween a child table and have a
junction table be the parent record. I had to strain to come up with
such a situation, and I've encountered it only a few times in my 15+
years of database application design.
 
O

oldblindpew

Hi, David, and thanks for your reply.

Side-issue: Person-to-Company sounds like a many-to-one relationship. I
thought the purpose of join tables was to handle many-to-many relationships.

Main issue: I like the concept of composite keys, but I read somewhere on
the internet from one published expert that composite keys should be avoided
because they create problems. My own experience is that even though Access
knows that a composite key is two fields that sometimes act as one, Access
apparently does not provide ready-made support for this reality. For
example, I like to use a list box as a navigation tool to allow the user to
pick a record, but this won't work with composite keys because the list box
is incapable of passing the value of more than one field.

Another question: In your first example, does your junction table actually
store PersonID and CompanyID twice, once as PK and again as FK?

Thanks, OBP
 
B

BruceM

I thought you were withdrawing from further response.

I remember seeing the posting you have copied here, but it isn't in this
thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top