# Geometry Relations

- [CONTAINS](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/contains.md): Synonym for ST\_CONTAINS. Checks if the first geometry completely contains the second geometry, with no points of the second geometry outside the first.
- [CROSSES](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/crosses.md): Synonym for ST\_CROSSES. Checks if two geometries cross, meaning they share some interior points but not all, and the intersection has a lower dimension.
- [DISJOINT](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/disjoint.md): Synonym for ST\_DISJOINT. Checks if two geometries are disjoint, meaning they have no points in common.
- [EQUALS](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/equals.md): Synonym for ST\_EQUALS. Checks if two geometries are spatially equal, meaning they contain exactly the same point set.
- [INTERSECTS](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/intersects.md): Synonym for ST\_INTERSECTS. Checks if two geometries intersect, meaning they share at least one common point.
- [OVERLAPS](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/overlaps.md): Synonym for ST\_OVERLAPS. Checks if two geometries overlap, sharing some but not all points, and having the same dimension.
- [ST\_CONTAINS](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-contains.md): Checks if geometry A contains geometry B. Returns 1 if B is completely inside A, 0 otherwise.
- [ST\_CROSSES](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-crosses.md): Checks if two geometries cross. Returns 1 if they intersect but one does not cover the other, and the intersection dimension is less than the maximum dimension.
- [ST\_DIFFERENCE](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_difference.md): Returns a geometry representing the difference between two geometries. The result contains points from the first geometry that are not in the second.
- [ST\_DISJOINT](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_disjoint.md): Checks if two geometries are disjoint. Returns 1 if the geometries share no points, 0 otherwise.
- [ST\_DISTANCE](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_distance.md): Calculates the shortest distance between two geometries. Returns the minimum Euclidean distance between any two points in the geometries.
- [ST\_DISTANCE\_SPHERE](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_distance_sphere.md): Calculates the spherical distance between two points or geometries. Uses a spherical earth model to determine the minimum distance in meters.
- [ST\_EQUALS](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-equals.md): Returns a geometry representing the difference between two geometries. The result contains points from the first geometry that are not in the second.
- [ST\_INTERSECTS](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-intersects.md): Checks if two geometries intersect. Returns 1 if the geometries share any portion of space (interior or boundary), 0 otherwise.
- [ST\_LENGTH](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st_length.md): Returns the length of a linear geometry. Calculates the total length of a LineString or MultiLineString in its associated spatial reference units.
- [ST\_OVERLAPS](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-overlaps.md): Checks if two geometries overlap. Returns 1 if they share space but neither completely contains the other, and they have the same dimension.
- [ST\_TOUCHES](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-touches.md): Checks if two geometries touch. Returns 1 if they intersect only at their boundaries and not their interiors.
- [ST\_WITHIN](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/st-within.md): Checks if geometry A is within geometry B. Returns 1 if A is completely inside B, 0 otherwise. This is the inverse of ST\_CONTAINS.
- [TOUCHES](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/touches.md): Synonym for ST\_TOUCHES. Checks if two geometries touch at their boundaries without their interiors intersecting.
- [WITHIN](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations/within.md): Synonym for ST\_WITHIN. Checks if the first geometry is completely enclosed by the second geometry.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/geometry-relations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
