MySQL provides a standard way of creating spatial columns for geometry types, for example, with MySQL提供了一种为几何体类型创建空间列的标准方法,例如,使用CREATE TABLE
or ALTER TABLE
. CREATE TABLE
或ALTER TABLE
。Spatial columns are supported for MyISAM
, InnoDB
, NDB
, and ARCHIVE
tables. MyISAM
、InnoDB
、NDB
和ARCHIVE
表支持空间列。See also the notes about spatial indexes under Section 11.4.10, “Creating Spatial Indexes”.另请参见第11.4.10节,“创建空间索引”中关于空间索引的注释。
Columns with a spatial data type can have an SRID attribute, to explicitly indicate the spatial reference system (SRS) for values stored in the column. For implications of an SRID-restricted column, see Section 11.4.1, “Spatial Data Types”.具有空间数据类型的列可以具有SRID属性,以明确指示存储在该列中的值的空间参考系统(SRS)。有关SRID限制列的含义,请参阅第11.4.1节,“空间数据类型”。
Use the 使用CREATE TABLE
statement to create a table with a spatial column:CREATE TABLE
语句创建具有空间列的表:
CREATE TABLE geom (g GEOMETRY);
Use the 使用ALTER TABLE
statement to add or drop a spatial column to or from an existing table:ALTER TABLE
语句可以将空间列添加到现有表或从现有表中删除空间列:
ALTER TABLE geom ADD pt POINT; ALTER TABLE geom DROP pt;