LOG( )

This MySQL function returns the logarithm of the first argument to the base indicated by the second argument.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

LOG(number[, base])

Explanation

This function returns the logarithm of the first argument to the base indicated by the second argument. This is the same as using LOG(number)/LOG(base). If the function is called with only the first argument, its natural logarithm is returned; the function is equivalent to LN in that case.

Examples

SELECT LOG(5,4);

+------------+
|   LOG(5,4) |
+------------+
| 1.16096405 |
+------------+