[Tutor] Is it possible to archive subsets of data from an SQLite db and restore it later?
alan.gauld at btinternet.com
Tue Aug 18 11:39:35 CEST 2015
On 18/08/15 10:02, Ben Finney wrote:
> Alan Gauld <alan.gauld at btinternet.com> writes:
>> A flag column that can be used to include/exclude students from
> So better than a boolean in the database, would be a timestamp (or just
> a date) indicating *when* the status changes. Either an ‘enrolled’
> timestamp, or a ‘departed’ timestamp, or both.
> Then you can interrogate the database about past, present, or future, by
> comparing that value with whatever point in time is of interest.
A date might be useful but its much harder to incorporate
into other reports. And given that virtually every query
potentially has to include this test (unless we go with
two views) that's a lot of overhead.
I'd go with a status flag (isEnrolled or somesuch) and if dates are
needed for specific reports add that as additional columns against
the flag. (enrollmentDate, leavingDate, etc)
But I'd also consider the YAGNI(*) principle. It's easy to add lots
of fields to databases that add to the admin load but are rarely,
if ever, used.
(*)You Aren't Going to Need It
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
More information about the Tutor