James K. Lowden, on Wednesday, February 26, 2020 11:55 AM, wrote...
>
> On Tue, 25 Feb 2020 12:02:24 -0500
> Przemek Klosowski wrote:
>
> > and I want to avoid storing repetitive data, so that the database
> > should contain
> > 10:32 12
> > 10:35 15
> > 10:39 13
> > 10:46 18
> > where only
On Wed, Feb 26, 2020 at 11:56 AM James K. Lowden
wrote:
> > and I want to avoid storing repetitive data, so that the database
> > should contain
> > [...]
> > only the earliest time with the unchanging value is stored.
>
> Be careful what you wish for. Usually "avoid storing" is a proxy for
>
On Tue, 25 Feb 2020 12:02:24 -0500
Przemek Klosowski wrote:
> and I want to avoid storing repetitive data, so that the database
> should contain
> 10:32 12
> 10:35 15
> 10:39 13
> 10:46 18
> where only the earliest time with the unchanging value is stored.
Be careful what you wish for.
>From: sqlite-users On
>Behalf Of Keith Medcalf
>Sent: Tuesday, 25 February, 2020 14:44
>To: SQLite mailing list
>Subject: Re: [sqlite] Fwd: inserting new data only
>
>
>If you are going to do it in all in one insert statement rather than
>using a before trigge
t;Subject: Re: [sqlite] Fwd: inserting new data only
>
>
>On Tuesday, 25 February, 2020 12:23, Przemek Klosowski
> wrote:
>
>>On Tue, Feb 25, 2020 at 1:18 PM Keith Medcalf
>wrote:
>
>>> create table data
>>> (
>>> keytext primary key,
>
On Tuesday, 25 February, 2020 12:23, Przemek Klosowski
wrote:
>On Tue, Feb 25, 2020 at 1:18 PM Keith Medcalf wrote:
>> create table data
>> (
>> keytext primary key,
>> data integer not null
>> )
>> without rowid;
>>
>> -- insert into data select ?, ? as value where value IS
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);
On Tue, Feb 25, 2020 at 1:18 PM Keith Medcalf wrote:
> create table data
> (
> keytext 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));
>..
>
Keith Medcalf
>Sent: Tuesday, 25 February, 2020 11:18
>To: 'SQLite mailing list'
>Subject: RE: [sqlite] Fwd: inserting new data only
>
>
>create table data
>(
>keytext primary key,
>data integer not null
>)
>without rowid;
>
>-- inser
create table data
(
keytext 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));
insert into data select '10:32', 12 as value where value IS NOT (select data
from
On Tue, Feb 25, 2020 at 1:03 PM John McKown
wrote:
> > I am storing time series data arriving from a sensor into (time,value)
> > records, like so:
> > 10:32 12
> > 10:35 15
> > 10:37 15
> > 10:39 13
> > 10:43 13
> > 10:46 18
> >
> > and I want to avoid storing repetitive data, so that the
On Tue, Feb 25, 2020 at 12:22 PM David Raymond wrote:
>
> A before trigger which uses the raise function would stop it from getting
> inserted in the first place.
>
> create trigger cull
> before insert on tbl
> when new.value = (select value from tbl order by time desc limit 1)
> begin
> select
On Tue, Feb 25, 2020 at 11:03 AM Przemek Klosowski <
przemek.klosowski+sql...@gmail.com> wrote:
> I am storing time series data arriving from a sensor into (time,value)
> records, like so:
> 10:32 12
> 10:35 15
> 10:37 15
> 10:39 13
> 10:43 13
> 10:46 18
>
> and I want to avoid storing
A before trigger which uses the raise function would stop it from getting
inserted in the first place.
create trigger cull
before insert on tbl
when new.value = (select value from tbl order by time desc limit 1)
begin
select raise(ignore);
end;
Or if you want it to actually return an error to
14 matches
Mail list logo