N
Nigel
I'd appreciate any thoughts on optimum design for the following situation.
I need to store data relating to periods of activity of a counter device
(counts animals). The device may be active (data collecting) or not, and if
not there's a list of valid reasons why not (e.g. power failure). Futhermore
different data-sampling routines may be active, though only one at a time.
The user may also have validated certain periods of operation which may or
may not relate to the data collection periods and these periods must also be
stored.
Current thinking is to have a table [ tblPeriods] with fields:
Period_ID
StartTime
EndTime
PeriodType (what type of period e.g. DataCollection, DataValidation,
SystemDown)
pnt_SamplingProtocol (pointer to table holding data sampling details)
If the period is of type SystemDown, then additional information on the
reason for the downtime period is stored in another table tblDownTimeReason)
and linked via a one-many-many-one intermediate table.
I can see that, strictly speaking, the 'entities' stored in [tblPeriods] are
not all the same (some are downtime periods some are data-collection
periods) and, as periods of different type have different field
requirements, I imagine they should really be in separate tables. Doing this
would result in multiple tables (e.g. [tblDownTimePeriods],
[tblDataCollectionPeriods]...) with very similar structures (ie. all will
have PeriodID, StartTime, EndTime etc.).
Althought this might be more academically correct it will mean most querying
(e.g 'show all periods of any type between date_1 and date_2' ) will
probably involve several UNIONs to get a result which could be a problem.
I can see a variety of other ways of storing these data, but there seem to
be compromises or other issues with each option. I would appreciate ny
independent thoughts or suggestions, or pointers to useful guide to table/db
design for more complex situations.
Thanks
Nigel
I need to store data relating to periods of activity of a counter device
(counts animals). The device may be active (data collecting) or not, and if
not there's a list of valid reasons why not (e.g. power failure). Futhermore
different data-sampling routines may be active, though only one at a time.
The user may also have validated certain periods of operation which may or
may not relate to the data collection periods and these periods must also be
stored.
Current thinking is to have a table [ tblPeriods] with fields:
Period_ID
StartTime
EndTime
PeriodType (what type of period e.g. DataCollection, DataValidation,
SystemDown)
pnt_SamplingProtocol (pointer to table holding data sampling details)
If the period is of type SystemDown, then additional information on the
reason for the downtime period is stored in another table tblDownTimeReason)
and linked via a one-many-many-one intermediate table.
I can see that, strictly speaking, the 'entities' stored in [tblPeriods] are
not all the same (some are downtime periods some are data-collection
periods) and, as periods of different type have different field
requirements, I imagine they should really be in separate tables. Doing this
would result in multiple tables (e.g. [tblDownTimePeriods],
[tblDataCollectionPeriods]...) with very similar structures (ie. all will
have PeriodID, StartTime, EndTime etc.).
Althought this might be more academically correct it will mean most querying
(e.g 'show all periods of any type between date_1 and date_2' ) will
probably involve several UNIONs to get a result which could be a problem.
I can see a variety of other ways of storing these data, but there seem to
be compromises or other issues with each option. I would appreciate ny
independent thoughts or suggestions, or pointers to useful guide to table/db
design for more complex situations.
Thanks
Nigel