In this guide, we will explain how to use the MySQL LN function with syntax and examples.
Description
The MySQL LN function returns the natural logarithm of a number.
Syntax
The syntax for the LN function in MySQL is:
LN( number )
Parameters or Arguments
number
The number to calculate the natural logarithm of. Must be greater than 0.
Note
- The LN function will return NULL, if number is less than or equal to 0.
- See also the LOG and EXP functions.
Applies To
The LN function can be used in the following versions :
- MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23
Example
Let’s look at some LN function examples and explore how to use the LN function.
For example:
mysql> SELECT LN(1); Result: 0 mysql> SELECT LN(2); Result: 0.6931471805599453 mysql> SELECT LN(2.5); Result: 0.9162907318741551 mysql> SELECT LN(0); Result: NULL mysql> SELECT LN(-1); Result: NULL
Next Topic : Click Here
Pingback: MySQL: LEAST Function | Adglob Infosystem Pvt Ltd