Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 33.6Mb
PDF (A4) - 33.6Mb
PDF (RPM) - 31.7Mb
HTML Download (TGZ) - 8.1Mb
HTML Download (Zip) - 8.1Mb
HTML Download (RPM) - 6.9Mb
Man Pages (TGZ) - 145.6Kb
Man Pages (Zip) - 206.4Kb
Info (Gzip) - 3.1Mb
Info (Zip) - 3.1Mb


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

Pre-General Availability Draft: 2017-10-20

11.5.8 Fetching Spatial Data

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;

User Comments
Sign Up Login You must be logged in to post a comment.