LOG
All functions > MATH > LOG
Returns the logarithm of a number to a specified base.
Syntax
LOG(base, expr) sql
Arguments
| Parameter | Type | Required | Description |
|---|---|---|---|
base | DOUBLE | Yes | The base of the logarithm (must be positive and ≠ 1) |
number | DOUBLE | Yes | Positive number to find the log of |
Returns
DOUBLE - Logarithm result
Notes
- Both base and number must be positive
- Base cannot be 1
LOG(base, 1) = 0for any valid baseLOG(base, base) = 1for any valid base- Returns NULL if any input is NULL
- Common bases: 10 (common log), 2 (binary log), e (natural log)