# ln

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: ln
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/sql-functions/math-functions/ln
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-functions/math-functions/ln.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/math-functions/ln.adoc
description: The `ln()` function returns the natural logarithm of its argument.
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-functions/math-functions/ln.md -->

The `ln()` function returns the natural logarithm of its argument.

> 📝 **NOTE**
>
> `ln()` does not accept negative numbers or zero.

## [](#syntax)Syntax

The syntax of the `ln()` function is:

```sql
LN (x)
```

`x`: A positive number, or an expression that evaluates to a positive number.

## [](#examples)Examples

### [](#basic-ln-function)Basic `ln()` function

The following example returns the natural logarithm of `7.87653`:

```sql
SELECT LN(7.87653);
```

The query returns:

```sql
+-------------+
| f           |
+-------------+
| 2.0638874   |
+-------------+
```

### [](#use-ln-function-with-a-table)Use `ln()` function with a table

This example combines the `ln()` function with a `CREATE TABLE` statement to obtain natural logarithmic values of a specific column:

1.  Create a new table named `LNtable` with an integer `initValue` column.

    ```sql
    CREATE TABLE LNtable(initValue int);
    INSERT INTO LNtable(initValue)
    VALUES (75), (18), (28);
    ```

2.  Run this query to get the logarithm output of the column:

    ```sql
    SELECT * ,LN(initValue) AS lnValue FROM LNtable;
    ```

3.  The query returns the initial value and its natural logarithm:

    -   `initValue`: The original integer values.

    -   `lnValue`: The natural logarithm values.

        ```sql
        +------------+---------------------------+
        | initValue  | lnValue                   |
        +------------+---------------------------+
        | 75         | 4.31748811353631          |
        | 18         | 2.8903717578961645        |
        | 28         | 3.332204510175204         |
        +------------+---------------------------+
        ```