Skip to content

SPATIAL

CREATE TABLE geom (g GEOMETRY);
INSERT INTO geom (g) VALUES (ST_GeomFromText('POINT(2 2)'));
SELECT ST_AsText(g) FROM geom;
+---------------+
| ST_AsText(g) |
+---------------+
| POINT(2 2) |
+---------------+

A table named ‘geom’ is created and a GEOMETRY type column ‘g’ is added. A POINT geometry is inserted into the ‘g’ column using the ST_GeomFromText function. The ST_AsText function is then used to retrieve the POINT geometry as a string from the ‘g’ column.