---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/unnest.md
cuppy_section: docs
cuppy_doc: 0W23-NTA2
cuppy_doc_uuid: e2667543-e80b-471c-ad08-79330495f31f
cuppy_permalink: https://cuppy.io/salesforce/d/0W23-NTA2
cuppy_version: 1
cuppy_updated: 2026-10-23T16:16:52.575Z
cuppy_canonical: https://cuppy.io/salesforce/docs/reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/unnest
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: 086b52024804c47aba94c7791ac6a651db090b5f553a02900ecf6347125e31a1
# cuppy_body_sha256 is over the document body ALONE, excluding both generated blocks.
---

> Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/unnest.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

## `unnest`

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

Expands the elements of one or more arrays into a set of rows.

*   `<array>`: The array to expand.

*   `...`: Additional arrays to expand in lock-step.

Returns a set of rows, each containing one element from the array(s). If multiple arrays are provided, they are expanded in lock-step. If the arrays aren’t all the same length, the shorter ones are padded with NULL values.

Results:

| day |
| --- |
| Mon |
| Tue |
| Wed |
| Thu |
| Fri |

The `WITH ORDINALITY` clause instructs `unnest` to also number the generated rows. Thereby, we know which element occured at which position in the original array.

Results:

| day | ordinality |
| --- | --- |
| Mon | 1 |
| Tue | 2 |
| Wed | 3 |
| Thu | 4 |
| Fri | 5 |

You can also call `unnest` with multiple array parameters. In this case, the arrays are expanded in lock-step. If the arrays aren’t all the same length, the shorter ones are padded with NULL values.

Results:

| name | task |
| --- | --- |
| Mon | ramp up |
| Tue | work |
| Wed | work |
| Thu | work |
| Fri | wrap up |
| Sat | NULL |
| Sun | NULL |

*   [Array Data Type](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/array.html)
*   [Array Functions](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/arrays.html)
*   [Set Returning Functions](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/set-returning-functions.html)


---
<!-- cuppy -->
You are reading one file. The same content is free over MCP at https://cuppy.io/mcp with no signup: ranked search across all 376 documents in this hub, the merged view when you work in a layer, known workarounds matched to the error you hit, and depth control so you spend tokens on what you need. Start with the `_hello` tool. How to connect: https://cuppy.io/salesforce/ Something wrong in this document? Report it with the `session feedback` tool on the same endpoint.
<!-- /cuppy -->
