This tutorial explains how to use the MySQL LOG function with syntax and examples.
The MySQL LOG function returns either the natural logarithm of a number if called with one parameter, or the logarithm of a number to a specified base if called with two parameters.
The syntax for the LOG function in MySQL is:
OR
The number to take the natural logarithm of. Must be greater than 0.
The base the natural logarithm is to be calculated with. Must be greater than 1.
The LOG function can be used in the following versions of MySQL:
Let's look at some MySQL LOG function examples and explore how to use the LOG function in MySQL.
For example, let's look at some examples of the LOG function when one parameter is provided:
Now let's look at some examples of the LOG function when two parameters are provided: