2018-01-23 1:02 GMT+01:00 Keith Medcalf <kmedc...@dessus.com>: > > Part of the problem is going to be that you have not defined the problem > sufficiently for a "solution" to be proposed. Based on your somewhat silly > example one can deduce the following constraints: > > With respect to "key": > - this is TEXT (UTF-8 or something else)? > - you specify check(length(key)) == 1 do you mean: > - one character in some encoding (key between 0 and 0xffffffffffffffff) > - one byte? (ie, ord(key) between 0 and 255) > - something else entirely? > - is it contiguous? > - if not contiguous what are the rules defining the non-contiguousness? >
I would like a general solution. So the type of key is not defined and it is not necessary to be contiguous. > - what is the "rotation order" based on? > - next arithmetic value, upper wraps to lower? > - next used key (by some collation order? Which collation order?) > - based on "used" values? > - based on "entire domain"? > Rotation is either up or down. In my example it was up. (In my perception.) Order is just the default order. > The problem and its solution is rather simple, once you define problem to > be solved with sufficient specificity to permit a solution. > > Your "example" below does not provide sufficient referents to generate a > solution that is cohesive over any problem domain other than that covered > by the example, and your referential constraints are inadequate to ensure > integrity for your limited example. > I think I can solve it generally. I will look into it and share it here. > >-----Original Message----- > >From: sqlite-users [mailto:sqlite-users- > >boun...@mailinglists.sqlite.org] On Behalf Of Cecil Westerhof > >Sent: Monday, 22 January, 2018 13:30 > >To: SQLite mailing list > >Subject: [sqlite] Can this be done with SQLite > > > >I have the following table: > >CREATE TABLE playYouTubeVideo ( > > key TEXT NOT NULL, > > speed FLOAT NOT NULL, > > > > CONSTRAINT key CHECK(length(key) == 1), > > CONSTRAINT speed CHECK(TYPEOF(speed) = "real"), > > > > PRIMARY KEY(key) > >); > > > > > >Say I want to rotate a part: > >- The value by key '1' becomes the value by key '2'. > >- The value by key '2' becomes the value by key '3'. > >- The value by key '3' becomes the value by key '4'. > >- The value by key '4' becomes the value by key '5'. > >- The value by key '5' becomes the value by key '6'. > > > >I suppose that I need to do this programmatically, or can this be > >done > >with SQL? > > > >And optionally also: > >- The value by key '1' becomes the value by key '5'. > -- Cecil Westerhof _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users