Link Search Menu Expand Document

LOG

Returns the common (base 10) logarithm of a numerical expression, or the logarithm to an arbitrary base if specified as the first argument.

Syntax

LOG([<base>,] <num>);
Parameter Description
<base> Optional. The base for the logarithm. The default base is 10.
<numeric> Valid values include column names, functions that return a column with numeric values, and constant numeric values.

Example

This example below returns the logarithm of 64.0 to base 2.

SELECT
    LOG(2, 64.0);

Returns: 6

This example below returns the logarithm of 100.0 to the default base 10.

SELECT
    LOG(100.0);

Returns: 2