LOG
Returns the logarithm of a numeric expr expression or another data type that can be implicitly converted to a numeric data type, on the given base.
Syntax
sql
LOG(base, expr)Arguments
expr: The numeric positive value to be processed.
base: "Base" is a numeric, positive value that is not equal to 1 and 0.
Return Values
The return value is of the DECIMAL data type.
Usage Notes
If base = 1 or base ≤ 0, an error is returned.
Example
sql
SELECT log(3, 9), log('0.5', '0.125'), log(exp(1), exp(1));+-----------+---------------------+---------------------+
| LOG(3, 9) | LOG('0.5', '0.125') | LOG(EXP(1), EXP(1)) |
|-----------+---------------------+---------------------|
| 2 | 3 | 1 |
+-----------+---------------------+---------------------+