# IS DISTINCT FROM

> 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: IS DISTINCT FROM
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/boolean-functions/is-distinct-from-operator
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-functions/boolean-functions/is-distinct-from-operator.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/boolean-functions/is-distinct-from-operator.adoc
description: The IS DISTINCT FROM operator compares two values and returns TRUE if they are different. NULLs are treated as comparable, so two NULLs are not distinct (returns FALSE).
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/boolean-functions/is-distinct-from-operator.md -->

The `IS DISTINCT FROM` operator compares two values and returns `TRUE` if they are different. ``NULL`s are treated as comparable, so two `NULL`s are not distinct (returns `FALSE``).

## [](#syntax)Syntax

The syntax for this function is:

```sql
value1 IS DISTINCT FROM value2
```

Where:

-   `value1` is the first value for comparison.

-   `value2` is the second value for comparison.


## [](#examples)Examples

### [](#basic-usage)Basic usage

Consider this example, which compares two values:

**Example 1**

```sql
SELECT NULL IS DISTINCT FROM NULL AS "Result";
```

The preceding query returns the output:

```sql
 Result
--------
 f
```

**Example 2**

```sql
SELECT 10 IS DISTINCT FROM 20 AS "Result";
```

The preceding query returns the output:

```sql
 Result
--------
 t
```

**Example 3**

```sql
SELECT 10 IS DISTINCT FROM 10 AS "Result";
```

The preceding query returns the output:

```sql
 Result
--------
 f
```

### [](#compare-null-values)Compare NULL values

In this example, `NULL` values are compared using the `IS DISTINCT FROM` operator:

**Example 1**

```sql
SELECT NULL IS DISTINCT FROM 10 AS "Result";
```

The preceding query returns the output:

```sql
 Result
--------
 t
```

**Example 2**

```sql
SELECT 10 IS DISTINCT FROM NULL AS "Result";
```

The preceding query returns the output:

```sql
 Result
--------
 t
```

### [](#track-inventory-variations)Track inventory variations

Suppose there is a table named `inventory_changes` that tracks changes in the quantities of products in a warehouse. The table has the structure:

```sql
CREATE TABLE inventory_changes (
  product_id INT,
  change_date DATE,
  change_quantity INT
);

INSERT INTO inventory_changes VALUES
(101, '2023-08-01', 50),
(102, '2023-08-01', 0),
(101, '2023-08-02', -15),
(103, '2023-08-03', 30),
(102, '2023-08-04', 0);
```

To retrieve records where the change quantity is distinct from zero, use the `IS DISTINCT FROM` operator.

```sql
SELECT *
FROM inventory_changes
WHERE change_quantity IS DISTINCT FROM 0;
```

The result of the query does not include the 0 values:

```sql
 product_id | change_date | change_quantity
------------+-------------+-----------------
        101 | 2023-08-01  |              50
        101 | 2023-08-02  |             -15
        103 | 2023-08-03  |              30
```