Топ-100
 
CerebroSQL

ST_X

Database: MySQL
Topic

ST_X(p[, new_x_val])

With a single argument representing a valid Point object p, ST_X()
returns the X-coordinate value of p as a double-precision number. As of
MySQL 8.0.12, the X coordinate is considered to refer to the axis that
appears first in the Point spatial reference system (SRS) definition.

With the optional second argument, ST_X() returns a Point object like
the first argument with its X coordinate equal to the second argument.
As of MySQL 8.0.12, if the Point object has a geographic SRS, the
second argument must be in the proper range for longitude or latitude
values.

ST_X() handles its arguments as described in the introduction to this
section.

URL: https://dev.mysql.com/doc/refman/8.0/en/gis-point-property-functions.html

Example

mysql> SELECT ST_X(Point(56.7, 53.34));
+--------------------------+
| ST_X(Point(56.7, 53.34)) |
+--------------------------+
| 56.7 |
+--------------------------+
mysql> SELECT ST_AsText(ST_X(Point(56.7, 53.34), 10.5));
+-------------------------------------------+
| ST_AsText(ST_X(Point(56.7, 53.34), 10.5)) |
+-------------------------------------------+
| POINT(10.5 53.34) |
+-------------------------------------------+