SQLite has an unorthodox dynamic typing system, where the column type does not determine the actual data type in the column, it simply encourages SQLite to convert the data to a specific type, if possible.
When trying to compare a string and a number, if the string is not a well-formed number, it is considered larger than the number.
Thus, it is obvious that for some reason these time values ββare not actually numbers, but strings. This is puzzling for two reasons. (1) Since the time column is of type decimal , it must have a "numerical" affinity, which should receive something in it that looks like a number converted to a number. (2) Even if the values ββwere stored as strings, they still had to be converted to numbers for comparison with 0.0004.
Why can't they be converted? Opportunity number 1: perhaps they contain extra spaces or something like that. Opportunity number 2: perhaps your language wants to use something different from . as a decimal point. (Perhaps there may be other possibilities that I did not think about.)
If you insert a record into a table that actually contains a number - insert into table_a (id,time) values (999,0.0001) or something like that, is this record included in your choice?
source share