James said:
Thanks for your comments and for the temporal SQL data link. I will
read it in its entirety before continuing to search for a solution to
this problem.
Let us know what you think of the book when your done. If you intend to
read it all there may be a delay in you replying <g>.
Here's my assessment so far as to why I think it's a worthwhile read.
Chapter 1 is an interesting introduction to temporal data and SQL-92;
though I should point out that implementation issues are discussed
throughout, including the Jet/Access platform. Chapters 2-4 are pretty
much compulsory reading. Chapter 4 justifies the preference for the
closed-open representation of time using start and end date pairs:
"the <i>closed-open</i> representation, in which the second datetime of
the pair represents the granule immediately following the last granule
of the period" (4.0, P89, PDF P113).
However, I prefer the variation made popular by Joe Celko (he doesn't
claim to have invented it) where the second datetime of the pair models
the last granule of the period, determined by the smallest granule
supported by the implementation e.g. one second for Jet/Access.
Contrast modelling of the current month:
start_date = #2006-07-01 00:00:00#, end_date = #2006-08-01 00:00:00#
(Snodgrass)
start_date = #2006-07-01 00:00:00#, end_date = #2006-07-31 23:59:59#
(Celko)
The primary reason AFAIK for the variation is that it makes the dates
unambiguous and facilitates BETWEEN clauses e.g.
my_date BETWEEN start_date AND end_date
The Snodgrass representation would erroneously return the row for the
current month for the value #2006-08-01 00:00:00#. You can pairs of >=
and < predicates but the single BETWEEN syntax makes the SQL more human
readable (more "human programmable" to coin the Celkoism).
Chapter 5 discusses state ('history') tables with emphasis on effective
constraints. However, there is a huge lost opportunity in the Access
implementation section of this chapter: "Neither version of Microsoft
Access [97 and 2000] supports assertions" (5.8.2 P133 PDF P157). It
seems to be a little known fact that Jet 4.0, and therefore Access2000
and upwards, supports table level CHECK constraints and, assuming the
CHECK is applied to each table used in the CHECK, you can effective
simulate domain level constraints and get very close to the SQL-92
ASSERTION syntax. Indeed, the examples used in the chapter can be
implemented using a CHECK constraint against a single table.
I'm basically working through chapters 6 and 7, querying and modifying
state tables respectively. I really need to progress to the following
three chapters about temporal logging at the row level (I think)
because I currently support a product that has issues in this area.
Chapter 10 looks particularly challenging...
Jamie.
--