## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> LOG[LOG]:::quoted
LOG --> End((END))
```
## Purpose
The `LOG` SQL function gets the natural logarithm of a number in a specified base.
See also [[LN]] and [[EXP]].
Parameters:
- Input (`decimal`): a number to get the logarithm from.
- Base (optional, `decimal`): the base to get the logarithm from. Defaults to the number e.
Returns: the natural logarithm of the input in the specified base.
## Examples
The following example retrieves the logarithm of 8 in base 2:
```sql
select log(8, 2)
-------------------
3
```
The following example retrieves the logarithm of 100 in base 10:
```sql
select log(100, 10)
-------------------
2
```
The following example retrieves the natural logarithm of 1:
```sql
select log(1)
-------------------
0
```