Re: Fwd: inserting new data only

Przemek Klosowski <[email protected]> Tue, 25 Feb 2020 14:23:12 -0500
Newsgroups gmane.comp.db.sqlite.general
Message-ID <CAC=1GgHm5-J85Wn+3mXfC0BLD+DhzCKHdbia+yUdtPAe_+i6NQ@mail.gmail.com>
On Tue, Feb 25, 2020 at 1:18 PM Keith Medcalf <[email protected]> wrote:
> create table data
> (
>     key    text primary key,
>     data   integer not null
> )
> without rowid;
>
> -- insert into data select (?, ? as value where value IS NOT (select data from (select max(key), data from data));
>..
> Constraints:
>
> (1) Will only work for appending data (new key > all keys in table)
> (2) Types of key and data are immaterial as long as you are only inserting (appending) new keys.

Awesome---exactly what's needed.
The monotonicity of the time key variable is assured by how the data
is collected---but  is there a way to express that in sqlite?
create table data (
  key text primary key check
(julianday(key) > julianday(select max(key) from data),
  data integer not null);
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users