A
accesskastle
Okay, I have a question about denormalizing. I have an activities table.
One particular activity that may take place is the setting of traps, each of
which has many captures. Another activity is hunting, which may also have
many captures. The problem I'm running into is whether I should have
multiple tables to account for the hierarchy or just combine it. Whether it
is a hunt or a trap, the data on the capture is relatively the same, but it
is necessary that I know (if it is a trapping activity) from which trap the
capture it came. Here's one possible structure, which will require a later
union query if I want to find all captures:
tblActivities
ActivityID PK (Counter)
Activity_Date (Date)
Activity_TypeID (Long)
....
tblTrapChecks
TrapCheckID (Counter)
ActivityID FK (Long, from tblActivities)
TrapID (Long)
Baited (Boolean)
....
tblTrapCaptures
TrapCaptureID (Counter)
TrapCheckID (Long, from tblTrapChecks)
AnimalID (Long)
SexID (Long)
Lbs (Currency)
AgeClassID (Long)
ColorID (Long)
....
tblHuntCaptures
HuntCaptureID (Counter)
AnimalID (Long)
Quantity (Long)
SexID (Long)
.....
Or, I could combine the hunt and trap capture tables and leave some fields
null, for example:
tblAllCaptures
CaptureID (Counter)
ActivityID (FK Long, Null in the case of a trapping capture)
TrapCheckID (FK Long, Null in the case of a hunt capture)
AnimalID
Quantity
SexID
Lbs
....
Can I get some advice on this? One table, two, or something else I might
have overlooked. I could be looking at this all wrong; I am still learning
about normalization. It would make sense to combine them so that I just have
one captures table, but I think that'll void referential integrity. On the
other hand, it might be annoying to have to union the data to bring it all
together.
AK
One particular activity that may take place is the setting of traps, each of
which has many captures. Another activity is hunting, which may also have
many captures. The problem I'm running into is whether I should have
multiple tables to account for the hierarchy or just combine it. Whether it
is a hunt or a trap, the data on the capture is relatively the same, but it
is necessary that I know (if it is a trapping activity) from which trap the
capture it came. Here's one possible structure, which will require a later
union query if I want to find all captures:
tblActivities
ActivityID PK (Counter)
Activity_Date (Date)
Activity_TypeID (Long)
....
tblTrapChecks
TrapCheckID (Counter)
ActivityID FK (Long, from tblActivities)
TrapID (Long)
Baited (Boolean)
....
tblTrapCaptures
TrapCaptureID (Counter)
TrapCheckID (Long, from tblTrapChecks)
AnimalID (Long)
SexID (Long)
Lbs (Currency)
AgeClassID (Long)
ColorID (Long)
....
tblHuntCaptures
HuntCaptureID (Counter)
AnimalID (Long)
Quantity (Long)
SexID (Long)
.....
Or, I could combine the hunt and trap capture tables and leave some fields
null, for example:
tblAllCaptures
CaptureID (Counter)
ActivityID (FK Long, Null in the case of a trapping capture)
TrapCheckID (FK Long, Null in the case of a hunt capture)
AnimalID
Quantity
SexID
Lbs
....
Can I get some advice on this? One table, two, or something else I might
have overlooked. I could be looking at this all wrong; I am still learning
about normalization. It would make sense to combine them so that I just have
one captures table, but I think that'll void referential integrity. On the
other hand, it might be annoying to have to union the data to bring it all
together.
AK