Ln Function In Sql in SQL
LN Function in SQL
The LN function returns the natural logarithm (logarithm to the base e) of a given number.
Syntax:
LN(number)number: The positive numeric value you want to find the natural logarithm of.
Example:
SELECT LN(10) AS natural_log;Result:
| natural_log |
|---|
| 2.302585 |
Notes:
The input number must be greater than 0; otherwise, the function returns
NULLor an error.Supported in MySQL, PostgreSQL, Oracle.
In SQL Server, the equivalent function is
LOG()(which defaults to natural logarithm).
If you want, I can provide examples with other logarithm functions too!