Hi john,
I see you are from Caltech. Did a postdoc there, nice place.
Anyway, to answer your first two questions, there is one sample_site from
which many samples are taken and one sample from which many bacterial
isolates are found, and so on. For each of these "backbone" tables there
would be many records for photos, tests, etc. For example, 5 photos taken
of
a sample and 6 tests done on a sample or isolate. Thus I have "sample" on
the
"one" side with photos on the many side and I do the exact same thing with
the other "backbone" tables like culture and bacterial isolate. So what I
am
doing is collecting a set of data (photos, tests, etc) about a
sample_source
then move to sample and take the exact same data types (photos, tests,
etc),
then move to culture, and the same date types right on down the "backbone".
I
have them joined where the same foreign key in photo is joined to each PK
in
the tables sample, isolate, etc.
I really find this interesting. For Laboratory work, there is redundancy
in
the data you collect at different stages of a process. It appears that
this
type of redundancy (the concept of taking the same types of data at
different
steps in a process- where each step must be a table in chain or backbone
of
joined tables) that is not common for most other databases themes.
I think you are right, it simply cannot be easily done and the best I can
do
is to implement integrity across some joins but not others (the other
suggestion was not compatible with the collection of the data, ie
descriptive
names, etc). This of course could create orphan records if someone deleted
a
record, however it is hard to imagine anyone actually deleting scientific
data so I doubt that it will not be a major problem.
By the way, I assume that the other way to have RI and take repetitive
types
of data at each step along a process is just to make individual tables and
forms for each step, however that makes things too confusing and balloons
the
db. For example, this would add about 50 extra tables to my db which is in
my
mind not worth the loss of RI across some joins.
One other thing that I don't understand, what is the purpose of being able
to add more than one copy of the same table to the Relationship window?
For
example, if I have tblPhoto and I add it again, I get tblPhoto_1???
Thanks a lot for your time and suggestions.
Vincent Johns said:
salmonella said:
I will try to simplify the problem. I have two tables called samples
and
Isolates, and would like to store pictures for both.
Can you store several (at least 2) pictures for one record in [Samples]?
Can you do that for [Isolates] as well?
I can join these each
with the same photo table on the many side
Many side of what? Can there be several [Samples] records for each
[Isolates] record?
and it works fine, UNLESS i use
referential integrity, in which case if i fill out sample than add a
photo to
it i get an access message saying that i have to fill out isolate also
(actually make sence!). Do i have to create 8 different tables to store
photos or can i somehow use the same photo table for storing all photos
in
the DB and use RI?
many thanks...
How you set up your Tables depends on your requirements. From what you
say, I'll guess that a photo is not required and can be added after the
record is. Is your [Photos] Table set up so that each record contains a
key linking it to [Isolates] and another key linking the record to
[Samples]? You could do that if you turn off referential integrity
(just for the [Photos] records) and allow some of those keys to have
null values. [Isolates] and [Samples] could still be linked using
referential integrity.
Another way to link them would be to have one [Photos] Table, which
would contain fields identifying the file names of the actual
photographs and maybe some descriptive information and to have two other
Tables referring to it. The [IsolatesPhotos] Table could contain a
field that links (many to one) to [Isolates] and another field linking
to [Photos] (one to one, but not all [Photos] records would be linked to
this Table). The [SamplesPhotos] Table would contain similar links,
except to [Samples] instead of [Isolates], and some of the [Photos]
records would be linked (one to one) to [SamplesPhotos]. The records in
[IsolatesPhotos] and [SamplesPhotos] would be small, each containing
nothing except two or three links, and you could enforce referential
integrity on these. Would that be closer to what you want to do?
I suppose I should mention that maintaining referential integrity may be
slightly overrated. It can save time, if you turn on "Cascade Delete",
for example, but having consistent records does not guarantee that you
have correct records. For that you need careful data entry.
-- Vincent Johns <
[email protected]>
Please feel free to quote anything I say here.