> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# nullif

> Returns NULL if expr1 is equal to expr2.

Returns NULL if `expr1` is equal to `expr2`. Otherwise, returns `expr1`.

## Syntax

```Haskell theme={null}
nullif(expr1,expr2);
```

## Parameters

`expr1` and `expr2` must be compatible in data type.

## Return value

The return value has the same type as `expr1`.

## Examples

```Plain Text theme={null}
mysql> select nullif(1,2);
+--------------+
| nullif(1, 2) |
+--------------+
|            1 |
+--------------+

mysql> select nullif(1,1);
+--------------+
| nullif(1, 1) |
+--------------+
|         NULL |
+--------------+
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.