8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

13.4.6 创建空间列13.4.6 Creating Spatial Columns

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 the CREATE TABLE statement to create a table with a spatial column:

    CREATE TABLE geom (g GEOMETRY);
    
  • 使用 ALTER TABLE 语句向现有表添加或删除空间列:Use the ALTER TABLE statement to add or drop a spatial column to or from an existing table:

    ALTER TABLE geom ADD pt POINT;
    ALTER TABLE geom DROP pt;