.create table.create table

创建新的空表。Creates a new empty table.

该命令必须在特定数据库的上下文中运行。The command must run in context of a specific database.

需要数据库用户权限Requires Database user permission.

语法Syntax

.create table TableName ([columnName:columnType], ...) [with ([docstring = Documentation] [, folder = FolderName] )].create table TableName ([columnName:columnType], ...) [with ([docstring = Documentation] [, folder = FolderName] )]

如果该表已存在,则此命令会返回成功。If the table already exists, the command will return success.

示例Example

.create table MyLogs ( Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32 ) 

返回输出Return output

以 JSON 格式返回表的架构,与下面的命令相同:Returns the table's schema in JSON format, same as:

.show table MyLogs schema as json

备注

若要创建多个表,请使用 .create tables 命令以提高性能并降低群集负载。For creating multiple tables, use the .create tables command for better performance and lower load on the cluster.