MySQL LN() Function

In MySQL, the LN() function returns the natural logarithm of the specified number.

LN() Syntax

Here is the syntax of MySQL LN() function:

LN(number)

The LN(number) function is the same as the LOG(number) function.

Parameters

number
Required. A number. The value must be greater than 0.

Return value

In MySQL, the LN() function returns the natural 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.

LN() Examples

SELECT
    LN(1),
    LN(2),
    LN(0),
    LN(-1),
    LN(NULL)\G

output

*************************** 1\. row ***************************
   LN(1): 0
   LN(2): 0.6931471805599453
   LN(0): NULL
  LN(-1): NULL
LN(NULL): NULL