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 drh at sqlite.org