MariaDB LOG10() Function

In MariaDB, LOG10() is a built-in function that returns the base 10 logarithm of the given parameter.

MariaDB LOG10() Syntax

Here is the syntax of the MariaDB LOG10() function:

LOG10(number)

LOG10(number) is equivalent to LOG(10, number).

Parameters

number

Required. A number used to calculate the logarithm. The value must be greater than 0.

If you provide the wrong number of parameters, MariaDB will report an error: ERROR 1582 (42000): Incorrect parameter count in the call to native function 'LOG10'.

Return value

The MariaDB LOG10() function returns the base 10 logarithm of the specified number.

If the parameter number is less than or equal to 0, the LOG10() function will return NULL.

If the parameter number is NULL, the LOG10() function will return NULL.

MariaDB LOG10() Examples

This statement shows the basic usage of the MariaDB LOG10() function:

SELECT
    LOG10(1),
    LOG10(100),
    LOG10(10000),
    LOG10(-1),
    LOG10(NULL)\G

Output:

    LOG10(1): 0
  LOG10(100): 2
LOG10(10000): 4
   LOG10(-1): NULL
 LOG10(NULL): NULL

Conclusion

In MariaDB, LOG10() is a built-in function that returns the base 10 logarithm of the given parameter.