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

# UNWIND

> The UNWIND clause breaks down a given list into a sequence of records; each contains a single element in the list.

The `UNWIND` clause transforms a list into individual rows, creating one row for each element in the list.

## Behavior

* Each element in the list becomes a separate row
* The order of rows preserves the original list order
* Useful for processing lists, creating multiple entities, or parameter expansion

## Basic Example

Create a node with an array property:

```sh theme={null}
GRAPH.QUERY DEMO_GRAPH "CREATE (p {array:[1,2,3]})"
```

Unwind the array into individual rows:

```sh theme={null}
GRAPH.QUERY DEMO_GRAPH "MATCH (p) UNWIND p.array AS y RETURN y"
```

**Result:**

```text theme={null}
y
1
2
3
```

## Practical Examples

### Create Multiple Nodes from a List

```sh theme={null}
GRAPH.QUERY DEMO_GRAPH
"UNWIND ['Alice', 'Bob', 'Charlie'] AS name
CREATE (:Person {name: name})"
```

### Process Nested Data

```sh theme={null}
GRAPH.QUERY DEMO_GRAPH
"WITH [{name: 'Alice', age: 30}, {name: 'Bob', age: 25}] AS people
UNWIND people AS person
CREATE (:Person {name: person.name, age: person.age})"
```

### Combine with Other Clauses

```sh theme={null}
GRAPH.QUERY DEMO_GRAPH
"MATCH (p:Person)
WITH collect(p.name) AS names
UNWIND names AS name
RETURN name ORDER BY name"
```

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="What does UNWIND do?">
    UNWIND transforms a list into individual rows, creating one row per element. It is the inverse of the `collect()` aggregation function.
  </Accordion>

  <Accordion title="Can I UNWIND a literal list?">
    Yes. You can unwind inline lists directly: `UNWIND ['Alice', 'Bob'] AS name CREATE (:Person {name: name})`. This is useful for batch operations.
  </Accordion>

  <Accordion title="What happens if I UNWIND an empty list?">
    If the list is empty, UNWIND produces zero rows, effectively eliminating that record from the result stream. No subsequent clauses will execute for that record.
  </Accordion>

  <Accordion title="Can I UNWIND nested lists or maps?">
    Yes. You can unwind lists of maps and access their properties: `UNWIND [{name: 'Alice'}, {name: 'Bob'}] AS person CREATE (:Person {name: person.name})`.
  </Accordion>
</AccordionGroup>
