[sqlite] Can I rely on this being ordered?

2012-07-03 Thread Bart Smissaert
Have the following table: CREATE TABLE READCODE( [SUBJECT_TYPE] TEXT, [READ_CODE] TEXT, [TERM30] TEXT, [TERM60] TEXT, [ENTRY_COUNT] INTEGER) Records are ordered ascending on READ_CODE as the records are obtained from an ordered array and inserted sequentially. There is a non-unique index on Read

Re: [sqlite] Can I rely on this being ordered?

2012-07-03 Thread Nico Williams
In SQL you cannot rely on the result set being in any order unless you use ORDER BY. This is true in SQLite3 as well. Nico -- ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Can I rely on this being ordered?

2012-07-03 Thread Bart Smissaert
OK, thanks, that confirms my suspicion then. RBS On Tue, Jul 3, 2012 at 10:00 PM, Igor Tandetnik itandet...@mvps.org wrote: On 7/3/2012 4:53 PM, Bart Smissaert wrote: However if I do this: SELECT READ_CODE, TERM30, TERM60, ENTRY_COUNT FROM READCODE WHERE TERM30 LIKE '%ANGINA%' UNION

Re: [sqlite] Can I rely on this being ordered?

2012-07-03 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/07/12 14:03, Bart Smissaert wrote: OK, thanks, that confirms my suspicion then. SQLite can also help you. Run your test suite normally, and then run again with this pragma which gives a different order to unordered selects. Your test suite

Re: [sqlite] Can I rely on this being ordered?

2012-07-03 Thread Petite Abeille
On Jul 3, 2012, at 11:03 PM, Bart Smissaert wrote: OK, thanks, that confirms my suspicion then. PRAGMA reverse_unordered_selects = boolean; When enabled, this PRAGMA causes SELECT statements without an ORDER BY clause to emit their results in the reverse order of what they normally would.

Re: [sqlite] Can I rely on this being ordered?

2012-07-03 Thread Bart Smissaert
Thanks for that tip, useful to know that one. RBS On Tue, Jul 3, 2012 at 11:37 PM, Roger Binns rog...@rogerbinns.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/07/12 14:03, Bart Smissaert wrote: OK, thanks, that confirms my suspicion then. SQLite can also help you.  Run