# Nullable

`Nullable(T)` allows a missing value where a typed member would otherwise require a value of type `T`. It is particularly useful for elements of arrays, tuple fields and map values.

## Syntax

```text
Nullable(T)
```

## Column and member nullability

Top-level SQL columns permit `NULL` unless they declare `NOT NULL`, including columns whose type is written without `Nullable`. The wrapper is needed to admit `NULL` inside a native composite value.

For example, `Array(UInt8)` requires a non-`NULL` integer at every position, while `Array(Nullable(UInt8))` can contain missing elements. Map keys cannot be nullable.

`Nullable` can wrap supported collections as well as scalar types. Use a column `NOT NULL` constraint to forbid a missing value at the top level.

## Finding NULL

Most comparisons with `NULL` return `NULL`, rather than true or false. Use `IS NULL` or `IS NOT NULL` to test for a missing value. Use `coalesce` to supply a fallback. Aggregate functions document whether they skip or retain `NULL` values.

## Usage Example

### A nullable array element

```sql
SELECT CAST('[1,null,3]' AS Array(Nullable(UInt8)))
FORMAT csv;
```

```text
"[1,null,3]"
```

### Testing and replacing NULL

```sql
SELECT NULL = NULL,
       NULL IS NULL,
       coalesce(NULL, 7)
FORMAT csv;
```

```text
\N,1,7
```

See [NULL functions](https://coordinatordb.com/docs/reference/functions/regular-functions/functions-for-nulls) for additional operations.
