SQLite ln() Function

The SQLite ln() function returns the natural logarithm of the number specified by the parameter.

Syntax

Here is the syntax of the SQLite ln() function:

ln(numeric_value)

Parameters

numeric_value

Required. A number whose logarithm needs to be obtained.

Return value

The SQLite ln() function returns the natural logarithm of the number specified by the parameter.

The SQLite ln() function will return NULL if the parameter is NULL.

The SQLite ln() function will return if the parameter is zero NULL.

The SQLite ln() function will return if the parameter is negative NULL.

If you provide a parameter that is not a number, the ln() function will return NULL.

Examples

This example shows the basic usage of the SQLite ln() function:

SELECT
    ln(1),
    ln(2),
    ln(3.3);
  ln(1) = 0.0
  ln(2) = 0.693147180559945
ln(3.3) = 1.19392246847243