ST_INTERSECTS
Returns TRUE if two GEOMETRY objects share any portion of space.
Syntax
ST_INTERSECTS(<geometry1>, <geometry2>)
Arguments
Return Type
Boolean.
Examples
SELECT ST_INTERSECTS(
TO_GEOMETRY('LINESTRING(0 0, 2 2)'),
TO_GEOMETRY('LINESTRING(0 2, 2 0)')
) AS intersects;
╭────────────╮
│ intersects │
├────────────┤
│ true │
╰────────────╯
SELECT ST_INTERSECTS(
TO_GEOMETRY('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
TO_GEOMETRY('POINT(3 3)')
) AS intersects;
╭────────────╮
│ intersects │
├────────────┤
│ false │
╰────────────╯