Along those lines SQLite includes the reverse_unordered_selects pragma https://www.sqlite.org/pragma.html#pragma_reverse_unordered_selects which will flip the order it sends rows in queries that don't explicitly specify an ordering. It's there to assist you in finding spots in your code where you might be relying on implicit ordering when you really shouldn't be.
Also available as a compile time option: SQLITE_REVERSE_UNORDERED_SELECTS -----Original Message----- From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> On Behalf Of Simon Slavin Sent: Thursday, November 7, 2019 12:16 PM To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Subject: Re: [sqlite] Deterministic random sampling via SELECT On 7 Nov 2019, at 1:56pm, David Raymond <david.raym...@tomtom.com> wrote: > Others will correct me if I'm wrong on that. No correction, but I wanted to add something. According to the theory of how SQL (not just SQLite, SQL) works, tables have no order. You can, in theory, query a table of 100 rows with SELECT a,b FROM MyTable LIMIT 5 ten times and get ten different answers, including different rows and/or the same rows in different orders. Given some of the text in the post that started this thread, I just wanted to make sure this was understood. In practise I have never seen a SQL engine which does this. Each SQL implementation seems to return the same result every time you repeat the same query. Though different SQL implementations can return different results. You'd have thought that at least one server/client system would return five rows which happened to be in the cache, but I've never seen this. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users