What is LN() in SQL?

The LN() function returns the natural logarithm of a number. To be more specific, it is the log with base e.

Figure 1 shows the mathematical representation of the LN() function.

Figure 1: Mathematical representation of LN() function

Syntax

LN(number)

Parameter

This function requires a number as a parameter. The number must be greater than zero.

Return value

LN() returns the natural logarithm of a number sent as a parameter.

If a parameter is less than or equal to zero, it returns NULL.

Example

/*example showing how to use LN(X)*/
-- positive number
select LN(10);
-- negative number
select LN(-6);
-- zero number
select LN(0);

Free Resources