---
title: log function
description: Learn the syntax of the log function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/log
---

# `log` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns the logarithm of `expr` with `base`.

## Syntax

```
log( [ base , ] expr)
```

## Arguments

* `base`: An optional expression that evaluates to a numeric.
* `expr`: An expression that evaluates to a numeric.

## Returns

A `DOUBLE`.

If `base` or `expr` are less than or equal to 0 the result is `NULL`.
`log(expr)` is a synonym for `ln(expr)`.

## Examples

```sql
> SELECT log(10, 100);
  2.0

> SELECT log(e());
  1.0
```

## Related functions

* [`log10` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/log10.md)
* [`ln` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/ln.md)
* [`log1p` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/log1p.md)
* [`pow` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/pow.md)
