LOG10 Function
The LOG10 function returns the log of a value to base 10. The following example returns the log base 10 of distance for each row of the travel table:
SELECT LOG10(distance) + 1 digits FROM travel;