On 18 February 2016 at 12:34, Richard Hipp <drh at sqlite.org> wrote: > On 2/18/16, Simon Davies <simon.james.davies at gmail.com> wrote: >> sqlite> select '11' <= 11; >> 0 >> sqlite> select '11' <= cast(11 as integer); >> 1 >> sqlite> select '11' >= 11; >> 1 > > Sort order in SQLite is: (1) NULLs, (2) Numeric values in numeric > order, (3) Strings in the order of whatever collating sequence > applies, and (4) BLOBs in lexicographical order. > > Hence, strings are always greater than numbers. Always. > > If you want to compare a string against it's numeric equivalent, you > need to cast the string to a number. > > -- > D. Richard Hipp
Ok on sort order, but why SQLite version 3.8.11.1 2015-07-29 20:00:57 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> sqlite> select '11' <= 11; 0 sqlite> select '11' <= cast(11 as integer); 1 Regards, Simon