# `ARRAY_COMPACT`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Returns an array with all NULL elements removed.

## Syntax

```sql
array_compact(<array>)
```

## Arguments

### Required

- `<array>`: The source array.

## Returns

Returns an array with all NULL elements removed.

## Considerations

- Removes only NULL elements, not empty strings or zero values.
- Non-NULL elements maintain their original order.

## Examples

### Remove NULL Elements

Remove all NULL values from an array.

```sql
SELECT array_compact(array[1, null, 2]) AS result;
```

Returns `array[1, 2]`, with the NULL element removed.

## Related Documentation

- [Array Data Type](/docs/data/data-cloud-query-guide/references/dc-sql-reference/array.md)
