# NULLIF

Returns NULL if the arguments are equal, otherwise the first argument.

## Syntax

```
NULLIF (val1, val2)

```

## Arguments

* Any SQL objects

## Return Type

The return value has the same type as the first argument, or NULL.

## Examples

```sql
SELECT NULLIF(1,2);

```

```output

+-------------+
| NULLIF(1,2) |
+-------------+
|           1 |
+-------------+

```

```sql
SELECT NULLIF(2,2);

```

```output

+-------------+
| NULLIF(2,2) |
+-------------+
|        NULL |
+-------------+
```

```sql
SELECT NULLIF(NULL, NULL);

```

```output

+--------------------+
| NULLIF(NULL, NULL) |
+--------------------+
| NULL               |
+--------------------+
```

```sql
SELECT NULL = NULL;

```

```output

+-------------+
| NULL = NULL |
+-------------+
|        NULL |
+-------------+
```

***

Modified at: February 24, 2023

Source: [/cloud/reference/sql-reference/conditional-functions/nullif/](https://docs.singlestore.com/cloud/reference/sql-reference/conditional-functions/nullif/)

(An index of the documentation is available at /llms.txt)
