📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

ST_WITHIN



Returns TRUE if the first GEOMETRY object is completely within the second GEOMETRY object.

Syntax

ST_WITHIN(<geometry1>, <geometry2>)

Arguments

ArgumentsDescription
<geometry1>The argument must be an expression of type GEOMETRY.
<geometry2>The argument must be an expression of type GEOMETRY.

Return Type

Boolean.

Examples

SELECT ST_WITHIN( TO_GEOMETRY('POINT(1 1)'), TO_GEOMETRY('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))') ) AS within; ╭─────────╮ │ within │ ├─────────┤ │ true │ ╰─────────╯

Was this page helpful?