Dom Dom <[EMAIL PROTECTED]> wrote:
> Igor Tandetnik <[EMAIL PROTECTED]> writes:
>
>> Would it be possible to get SQLAlchemy to cast to REAL, FLOAT or
>> DOUBLE rather than NUMERIC?
>
> Hello Igor,
> Thanks for answering.
>
>> Casting to NUMERIC leaves integers as integers;
>> basically, it's a no-op in your query.
>
> Are you sure ?

Yes.

>
> When I do in my Query1 10/2, it gives 5. Fine
> If I do 11/2, it gives 5 and not 5.5. It seems it's a classic problem
> of division.

I don't see a contradiction between this and my statement.

Compare and contrast:

select
    11 / 2,
    11.0 / 2,
    11 / 2.0,
    cast(11 as real) / 2,
    cast(11 as numeric) / 2;

Exercise for the reader: run this statement in SQLite, explain its 
output. Discuss.

Igor Tandetnik 



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

Reply via email to