表管理Tables management

本主题讨论表的生命周期和相关控制命令。This topic discusses the life cycle of tables and associated control commands.

请选择下表中的链接,以获取相关详细信息。Select the links in the table below for more information about them.

命令Commands 操作Operation
.alter table docstring, .alter table folder.alter table docstring, .alter table folder 管理表显示属性Manage table display properties
.create ingestion mapping, .show ingestion mappings, .alter ingestion mapping, .drop ingestion mapping.create ingestion mapping, .show ingestion mappings, .alter ingestion mapping, .drop ingestion mapping 管理引入映射Manage ingestion mapping
.create tables, .create table, .alter table, .alter-merge table, .drop tables, .drop table, .undo drop table, .rename table.create tables, .create table, .alter table, .alter-merge table, .drop tables, .drop table, .undo drop table, .rename table 创建/修改/删除表Create/modify/drop tables
.show tables .show table details.show table schema.show tables .show table details.show table schema 枚举数据库中的表Enumerate tables in a database
.ingest.set.append.set-or-append(有关详细信息,请参阅数据引入)。.ingest, .set, .append, .set-or-append (see Data Ingestion for details).) 将数据引入到表中Data ingestion into a table

表的 CRUD 命名约定CRUD naming conventions for tables

(有关完整详细信息,请参阅上表中的链接部分。)(See full details in the sections linked to in the table, above.)

命令语法Command syntax 语义Semantics
.create entityType entityName ... 如果该类型和名称的实体存在,则返回该实体。If an entity of that type and name exists, returns the entity. 否则,创建该实体。Otherwise, create the entity.
.create-merge entityType entityName... 如果该类型和名称的实体存在,则将现有实体与指定的实体合并。If an entity of that type and name exists, merge the existing entity with the specified entity. 否则,创建该实体。Otherwise, create the entity.
.alter entityType entityName ... 如果该类型和名称的实体不存在,则会出错。If an entity of that type and name does not exist, error. 否则,请将其替换为指定的实体。Otherwise, replace it with the specified entity.
.alter-merge entityType entityName ... 如果该类型和名称的实体不存在,则会出错。If an entity of that type and name does not exist, error. 否则,请将其与指定的实体合并。Otherwise, merge it with the specified entity.
.drop entityType entityName ... 如果该类型和名称的实体不存在,则会出错。If an entity of that type and name does not exist, error. 否则,请将其删除。Otherwise, drop it.
.drop entityType entityName ifexists ... 如果该类型和名称的实体不存在,则返回。If an entity of that type and name does not exist, return. 否则,请将其删除。Otherwise, drop it.

备注

“合并”是两个实体的逻辑合并:"Merge" is a logical merge of two entities:

  • 如果一个属性是为一个实体定义的,而不是为另一个实体定义的,则该属性将与其原始值一起出现在合并的实体中。If a property is defined for one entity but not the other, it appears with its original value in the merged entity.
  • 如果一个属性是为两个实体定义的,并且在这两个实体中具有相同的值,则该属性与该值一起在合并的实体中出现一次。If a property is defined for both entities and has the same value in both, it appears once with that value in the merged entity.
  • 如果一个属性是为两个实体定义的,但具有不同的值,则会引发错误。If a property is defined for both entities but has different values, an error is raised.