Creating a Table
You can use the basic data types in creating a table. For example, here is a simple table:
CREATE TABLE location_points (id integer, shape point);
Creating tables with LINESTRING or POLYGON data types is just as easy:
CREATE TABLE location_lines (id integer, shape linestring);
CREATE TABLE location_polygons (id integer, shape polygon);
Here the spatial column is called shape, which is a standard name for spatial columns in some databases. It is not a reserved keyword; you can change it to any legal column name. Likewise, the table name location_... is merely descriptive and can be changed to any legal table name. Or you can even simply add a spatial column to an existing table.
Spatial columns can also be created in dynamic views and in subselects (not demonstrated in this tutorial).
Last modified date: 08/28/2024