Was this helpful?
Point Data Type
A Point has an X and a Y coordinate and optionally a Spatial Reference System Identifier (SRID).
Examples:
Without specifying SRID:
CREATE TABLE houses (id VARCHAR(30), location POINT);
With specifying SRID:
CREATE TABLE houses (id VARCHAR(30), location POINT SRID 26911);
Use X and Y coordinates to represent houses:
CREATE TABLE houses (id INTEGER PRIMARY KEY, location POINT NOT NULL );
 
INSERT INTO houses (id, location) VALUES (1, POINTFROMTEXT('POINT(0 0)'));
 
INSERT INTO houses (id, location) VALUES (2, POINTFROMTEXT('POINT(5 10)'));
Calculate the distance from a point (4, 4) to each house:
SELECT DISTANCE(location, POINTFROMTEXT('POINT(4 4)')) FROM houses;
-----------
col1
-----------
      5.657
      6.083
-----------
Last modified date: 04/03/2024