Documentation Home
MySQL 8.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 39.8Mb
PDF (A4) - 39.9Mb
Man Pages (TGZ) - 257.9Kb
Man Pages (Zip) - 364.9Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb


MySQL 8.4 Reference Manual  /  ...  /  Fetching Spatial Data

13.4.8 获取空间数据

Geometry values stored in a table can be fetched in internal format. You can also convert them to WKT or WKB format.

  • Fetching spatial data in internal format:

    Fetching geometry values using internal format can be useful in table-to-table transfers:

    CREATE TABLE geom2 (g GEOMETRY) SELECT g FROM geom;
  • Fetching spatial data in WKT format:

    The ST_AsText() function converts a geometry from internal format to a WKT string.

    SELECT ST_AsText(g) FROM geom;
  • Fetching spatial data in WKB format:

    The ST_AsBinary() function converts a geometry from internal format to a BLOB containing the WKB value.

    SELECT ST_AsBinary(g) FROM geom;