On Sat, Oct 15, 2016 at 11:58 AM, Keith Medcalf <kmedc...@dessus.com> wrote:
> I'd just sort the data into the order I wanted the result set presented in
> using an ORDER BY clause on the SELECT which retrieves the data ...
One other thought I saw someone else propose a while ago... treat the
number as floating piont, and you can insert at (prior+current)/2 ... 1.5,
1.25, 1.125 etc....
> > > On Oct 15, 2016, at 11:12 AM, Keith Medcalf <kmedc...@dessus.com>
> > >
> > >> Is there a way to do this automagically (like a specialized INSERT
> > >> command?) in Sqlite?
> > >
> > > Unfortunately no, there is no way to do this on *ANY* database that
> > the relational database model.
> > There’s no need to dive into database theory! I’ll play devil’s advocate
> > and say that this could pretty easily be done in SQLite by writing a
> > simple extension function like in inbetween(a, b) that takes two strings
> > and returns a string that sorts in between them, as I described
> > previously.
> > Then you just make the table’s primary key a string and do
> > INSERT INTO mytable (ID, …) VALUES (inbetween($firstid, $secondid),
> > …)
> > where $firstid and $secondid are the the primary keys of the two rows you
> > want to insert between.
> > In real life you’d probably just implement inbetween() as part of your
> > program instead of as a SQLite function; I just wanted to prove that a
> > relational database can in fact do this.
> > —Jens
> sqlite-users mailing list
sqlite-users mailing list