I’m using the `ROUND` statement in some queries wh...
# sql
a
I’m using the
ROUND
statement in some queries where I need to calculate the percentage. For example
Copy code
SELECT path, type, ROUND((blocks_available * blocks_size * 10e-10), 2) AS free_gb, ROUND ((blocks_available * 1.0 / blocks * 1.0) * 100, 2) AS free_perc FROM mounts WHERE path = '/';
I expect the percentage to have
two digits
after the decimal point, but instead I get values like
51.020000000000003
. Can anyone tell why this is or how I can fix this? These long numbers are hard to read for percentage values.