-----Original Message----- From: J. King

Someone please correct me if I'm wrong, but I believe it's mandated by the SQL standard that integer division is used when both operands are integers.

I really don't know what the standard says, but here are two different opinions in implementation.

MySQL example:
mysql> select 1/2;
+--------+
| 1/2    |
+--------+
| 0.5000 |
+--------+
1 row in set (0.13 sec)

PostgreSQL example:
psql=# select 1/2;
?column?
----------
       0
(1 row)


Your synthetic example doesn't use a fixed table, but if it did the easiest solution for you would probably be to define any columns where you need arbitrary precision as REAL rather than INTEGER, and SQLite column >affinity would do the rest.

SQLite3 (https://sqlite.org/datatype3.html) -- "Otherwise, an expression has no affinity. "
It seems that 'no affinity' gets translated to integer affinity, then.

Is there a way to default to float?

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

Reply via email to