On Fri, Feb 10, 2012 at 6:11 AM, Max Vlasov <max.vla...@gmail.com> wrote:

> Hi,
> working with sqlite and mysql, noticed that they're different in regard of
> mixed types.
>  Select '24' < 25
>  Select 24 < 25
> have the same results in MySql and different sqlite.
>
> Actually it's no news (my sqlite queries contained CAST(.. as INT) ), but I
> decided to look at the docs and noticed that first sentence
>
> http://www.sqlite.org/datatype3.html
>
>  ...If one operand has INTEGER, REAL or NUMERIC affinity and the other
> operand as TEXT or NONE affinity then NUMERIC affinity is applied to other
> operand.
> but below
>  ...Because column "a" has text affinity, numeric values on the
> right-hand side of the comparisons are converted to text before  the
> comparison occurs.
>
> Shouldn't the first be fixed to end with "...then TEXT affinity is applied
> to other operand"?
>

In the statement:

    SELECT '25' < 25;

There are no columns, only literals.  And hence no affinity is applied.


>
> Max
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to