メインコンテンツまでスキップ

st_x function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 17.1 and above

Preview

This feature is in Public Preview.

注記

This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types

Returns the X coordinate of the input point GEOMETRY, or NULL if the point is empty.

Syntax

st_x ( geoExpr )

Arguments

  • geoExpr: A GEOMETRY value.

Returns

A value of type DOUBLE, X coordinate of the input point GEOMETRY.

The function returns NULL if the input is NULL or if the point is empty.

Error conditions

Examples

SQL
-- Returns the X coordinate of a non-empty point geometry.
> SELECT st_x(st_geomfromtext('POINT Z (2 3 4)'));
2.0
-- Returns `NULL` for an empty point geometry.
> SELECT st_x(st_geomfromtext('POINT ZM EMPTY'));
NULL