On 12 Jan 2017, at 12:45am, Richard Hipp <d...@sqlite.org> wrote:

> On 1/11/17, Bart Smissaert <bart.smissa...@gmail.com> wrote:
>> 
>> The result is that the output is descending on DOB.
>> I expected and preferred if the output was ascending on rowid.
> 
> If you omit the ORDER BY clause, then the SQL database engine (*any*
> engine, not just SQLite) is free to return the rows in whatever random
> order it chooses.  And it does not need to explain itself when it
> does.  :-)

Not only that, but SQLite may return them in one order one day, and another 
order a different day, without you changing a single line of your program or 
recompiling it.  You may use the command-line tool to add another index to the 
database and it may decide to use that one.  Or you may run ANALYZE.

So just because you’ve seen it decide to use IDX_TABLE1_DOB while you’re 
developing your program, don’t depend on it doing the same thing on your 
customer’s site.  As Richard wrote, if you want something specific, ask for it 
specifically.

On 12 Jan 2017, at 12:49am, Richard Hipp <d...@sqlite.org> wrote:

> For years I have threatened to make it a feature of SQLite that it
> really does output the rows in some random order if you omit the ORDER
> BY clause

SQLITE_CONFIG_RANDOMIZEWHATYOUCAN_LOL

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to