perhaps I wrongly put in words, what John Vinson[MVP] described was right - i
should ask, "Many fields in a table which are declared as Primary
Key".....thanks to also Klatuu, Lynn Trapp, Daniel for the explanation as
well.
I was curious because I did come across a Table with not only 1 field
declared as Primary Key but had 3 fields being declared as Primary keys. (I
am referring to Access Application) - ?
Subtle difference: You do not have three fields, each of them being a
primary key in its own right. Instead, you have three fields which
TOGETHER constitute a single Primary Key. Any one of the fields can
have duplicates, but you cannot create a new record which has
identical values to an existing record in all three fields.
as an example:
If a school have 4 trainers teaching 5 types of courses and all these
trainers are teaching all the 5 courses but all teach at different class
rooms and some of trainers are teaching at the same time and some are not.
in the above scenario, how would I place the Primary Key on which fields ?
thanks for the discussion and assistance render
Jerry's suggestions are on target. I wouldn't go quite so far as to
say you should NEVER have a multifield primary key, but the
information you describe should be stored in several tables, not just
one.
If you had a table with fields CourseID, TrainerID, and ClassLocation
and wanted to prevent entering the same course/trainer/location twice,
you could ctrl-click these three fields in table design view and click
the Key icon to make them a joint, three-field primary key. But... you
probably don't WANT a table structured in this way! See Jerry's post
for an alternative structure.
John W. Vinson[MVP]