The LOG10 SQL Function in MySQL and MariaDB - Logarithm to the base 10
LOG10
Syntax:
LOG10(Number)
Return value:
FLOAT
Function type:
Numeric function
Function Description
The LOG10() function returns the logarithm based on 10 of "Number".
If the value of Number is less than or equal to 0, NULL is returned.
If "Number" is NULL, the LOG10() function returns NULL.
SQL Examples for the LOG10 function
1 2 3 4 5
selectlog10(2.4) as result;selectlog10(2) as result;selectlog10(-2) as result;
result
double(23)
0.38021124171160603
result
double(23)
0.3010299956639812
result
double(23)
NULL
The examples were created with the MyWAY SQL manager: Download
How to use the LOG10() function in MySQL and MariaDB databases
The LOG10() function in MySQL and MariaDB is used when there is a need to calculate base 10 logarithms, for example when working with logarithmic scales or analyzing data that follow a base 10 logarithmic relationship. The function uses floating-point arithmetic, so the precision of the result depends on the underlying data type.