MySQL LOG() Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL LOG() Function

❮ MySQL Functions

Example

Return the natural logarithm of a number:

SELECT LOG(2);
Try it Yourself »

Definition and Usage

The LOG() function returns the natural logarithm of a number, or the logarithm of a number to a specified base.

Note: See also the LN() and EXP() functions.

Syntax

LOG(number)

OR:

LOG(base, number)

Parameter Values

Parameter Description
number The number to return the natural logarithm of. Must be greater than 0
base The base the natural logarithm is to be calculated with. Must be greater than 1

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

More Examples

Example

Return the natural logarithm of a number to a specified base:

SELECT LOG(2, 4);
Try it Yourself »

❮ MySQL Functions