Re: [sqlite] [EXTERNAL] Re: random rows

2018-06-01 Thread Keith Medcalf
Good idea but if there is no AUTOINCREMENT you can simply get the min/max directly: I think the following works (and for both + and - rowid's) NB: The MaxRowID is not needed with Rows(MinRowID, NumRows) as (select min(RowID) as MinRowID, max(RowID) -

Re: [sqlite] Size of the SQLite library

2018-06-01 Thread Warren Young
On May 31, 2018, at 6:32 PM, Roger Binns wrote: > > On 31/05/18 10:15, Richard Hipp wrote: >> Size is still important. But having useful features is important too. >> I'm continuing to work to find the right balance between these >> competing goals. > > A pattern used in other projects is to

Re: [sqlite] [EXTERNAL] Re: random rows

2018-06-01 Thread Keith Medcalf
Good idea but if there is no AUTOINCREMENT you can simply get the min/max directly: I think the following might work (and should work for both + and - rowid's) with Rows(MinRowID, MaxRowID, NumRows) as (select min(RowID) as MinRowID,

Re: [sqlite] SQL Date Import

2018-06-01 Thread Keith Medcalf
Yes, and the database will store the data as entered/bound if it cannot be converted to the requested storage type (column affinity). This is VERY IMPORTANT for you to understand fully and completely including all the rules for storage class and affinity conversions and how they are

Re: [sqlite] [EXTERNAL] Re: random rows

2018-06-01 Thread Hick Gunter
Just an idea: If the table has an INTEGER PRIMARY KEY AUTOINCREMENT then then maximum rowid is available in the sqlite_sequence table. To generate a random sequence of rowids, this can be used, somewhat like SELECT DISTINCT rnd() * (SELECT seq FROM sqlite_sequence WHERE name='') as rowid;

[sqlite] SQL Date Import

2018-06-01 Thread dmp
Currently I do not have SQLite setup to run on its own on a computer. I figured the answer to my question would be faster if it was posed to this list. Given: CREATE TABLE exdate ( id INTEGER, mydate DATE NOT NULL, PRIMARY KEY (id) ); Once a number, numeric, is stored. Can a command line

Re: [sqlite] Size of the SQLite library

2018-06-01 Thread dmp
1. Define in documentation as < 1Mb. (Don't have to visit again.) 2. Continue to strive to keep in the 0.5-1MB range. 3. Add some information on building a MINIMUM size for those concerned that is relatively easy to accomplish without a lot of expertise if possible. danap.

Re: [sqlite] random rows

2018-06-01 Thread Stephen Chrzanowski
Here's my two cents. Don't spend it all in one place... CREATE TABLE [RandomTable]( [PriID] INTEGER PRIMARY KEY AUTOINCREMENT, [DataCol] CHAR); INSERT INTO [RandomTable]([PriID], [DataCol]) VALUES(1, 'a'); INSERT INTO [RandomTable]([PriID], [DataCol]) VALUES(2, 'b'); INSERT INTO

Re: [sqlite] random rows

2018-06-01 Thread Don V Nielsen
?? SELECT * FROM table WHERE id IN (SELECT id FROM table ORDER BY RANDOM() LIMIT x) Maybe. It is more memory efficient then trying to sort the entire lot of data. On Thu, May 31, 2018 at 7:13 PM Torsten Curdt wrote: > I need to get some random rows from a large(ish) table. > > The following

Re: [sqlite] random rows

2018-06-01 Thread Shevek
You may find it faster to do: select c from t where rowid in (list-of-constants) and generate the list of constants using something like a blackrock permutation generator. That takes linear time, whereas all the order-by variants are n.log(n). You need some sort of row-id generator function,