Here is a query in PostgreSQL:
SELECT 25/8175133
This show 0 as result, while the actual value is 0.00000305805
I tried
SELECT CAST(25/8175133 AS DECIMAL)
SELECT CAST(25/8175133 AS AS DOUBLE PRECISION)
but nothing seems to work. Is there are way to show very low fraction values in our SELECT output?
When PostgreSQL divides two integer values the result is an integer. If you want decimal places you need to include at least one operand with decimal places.
You can do:
SELECT 1.0 * 25/8175133
or:
SELECT 25.0/8175133
Result:
?column?
--------
0.000003058054223704984372