MySQL: LN Function
This MySQL tutorial explains 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
Applies To
The LN function can be used in the following versions of MySQL:
- 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 MySQL LN function examples and explore how to use the LN function in MySQL.
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
Advertisements