MySQL 提供了一种为几何类型创建空间列的标准方式,例如,通过 CREATE
TABLE 或 ALTER TABLE。空间列在 MyISAM、InnoDB、NDB 和 ARCHIVE 表中受支持。另请参阅 第 13.4.10 节,“创建空间索引” 中关于空间索引的说明。MySQL provides a standard way of creating spatial columns for
geometry types, for example, with CREATE
TABLE or ALTER TABLE.
Spatial columns are supported for
MyISAM,
InnoDB,
NDB, and
ARCHIVE tables. See also the notes
about spatial indexes under
Section 13.4.10, “Creating Spatial Indexes”.
具有空间数据类型的列可以具有 SRID 属性,用于明确指示存储在列中的值的空间参考系统 (SRS)。有关 SRID 受限列的影响,请参见 第 13.4.1 节,“空间数据类型”。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 13.4.1, “Spatial Data Types”.
使用
CREATE TABLE语句创建带有空间列的表:Use theCREATE TABLEstatement to create a table with a spatial column:CREATE TABLE geom (g GEOMETRY);
使用
ALTER TABLE语句向现有表添加或删除空间列:Use theALTER TABLEstatement to add or drop a spatial column to or from an existing table:ALTER TABLE geom ADD pt POINT; ALTER TABLE geom DROP pt;