ID EN
Mathematical Functions

LOG(X)

MySQL 8.4

LOG(X), LOG(B,X)

Syntax

MYSQL
SELECT LOG(2);
0.69314718055995
SELECT LOG(-2);
NULL

Examples

Example

If called with one parameter, this function returns the natural logarithm of X. If X is less than or equal to 0.0E0, the function returns NULL and a warning “Invalid argument for logarithm” is reported. Returns NULL if X or B is NULL.

MYSQL
SELECT LOG(2);
0.69314718055995
SELECT LOG(-2);
NULL
Example 2

The inverse of this function (when called with a single argument) is the EXP() function.

MYSQL
SELECT LOG(2,65536);
16
SELECT LOG(10,100);
2
SELECT LOG(1,100);
NULL