This tutorial explains how to use the MySQL LN function with syntax and examples.
The MySQL LN function returns the natural logarithm of a number.
The syntax for the LN function in MySQL is:
LN( number )
The number to calculate the natural logarithm of. Must be greater than 0.
The LN function can be used in the following versions of MySQL:
Let's look at some MySQL LN function examples and explore how to use the LN function in MySQL.
For example:
mysql> SELECT LN(1);
Output: 0
mysql> SELECT LN(2);
Output: 0.6931471805599453
mysql> SELECT LN(2.5);
Output: 0.9162907318741551
mysql> SELECT LN(0);
Output: NULL
mysql> SELECT LN(-1);
Output: NULL