MySQL LOG10() Function

In MySQL, the LOG10() function returns the base 10 logarithm of the specified number.

LOG10() Syntax

Here is the syntax of MySQL LOG10() function:

LOG10(number)

The LOG10(number) function is the same as LOG(10, number) function.

Parameters

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

Return value

In MySQL, the LOG10() function returns the base 10 logarithm of the specified number.

  • If number is less than or equal to 0, the function will return NULL.
  • If number is NULL, the function will return NULL.

LOG10() Examples

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

output

*************************** 1\. row ***************************
    LOG10(1): 0
  LOG10(100): 2
LOG10(10000): 4
   LOG10(-1): NULL
 LOG10(NULL): NULL