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

# ST_Difference

Return the difference between geometry A and B (return part of geometry A that does not intersect geometry B)

<img src="https://mintcdn.com/wherobots/fqh3gPDE0J25Lra_/images/sql-functions/ST_Difference/ST_Difference.svg?fit=max&auto=format&n=fqh3gPDE0J25Lra_&q=85&s=9326309c6d692c536e46d0aacd6234f7" alt="ST_Difference" width="500" height="300" data-path="images/sql-functions/ST_Difference/ST_Difference.svg" />

## Signatures

```sql theme={"system"}
ST_Difference (A: Geometry, B: Geometry)
```

## Parameters

<ParamField body="A" type="Geometry" required>
  The input geometry.
</ParamField>

<ParamField body="B" type="Geometry" required>
  The second geometry.
</ParamField>

## Return type

<ResponseField type="Geometry">
  The resulting geometry.
</ResponseField>

## Example

```sql theme={"system"}
SELECT ST_Difference(ST_GeomFromWKT('POLYGON ((-3 -3, 3 -3, 3 3, -3 3, -3 -3))'), ST_GeomFromWKT('POLYGON ((0 -4, 4 -4, 4 4, 0 4, 0 -4))'))
```

```
POLYGON ((0 -3, -3 -3, -3 3, 0 3, 0 -3))
```
