clickhouse 建表create table 报错Expected one of: storage definition, ENGINE, AS

clickhouse在建表create table时,必须指定引擎类型,否则就会报Expected one of: storage definition, ENGINE, AS错误。

报错样例

localhost :) create table t1(id int, name varchar(100),birthday date);
Syntax error: failed at position 57 (end of query):
create table t1(id int, name varchar(100),birthday date);
Expected one of: storage definition, ENGINE, AS

解决方案

增加引擎指定,并且按照引擎要求提供必要的参数。

localhost :) create table t1(id int, name varchar(100),birthday date)ENGINE = MergeTree() primary key id;

CREATE TABLE t1
(
    `id` int,
    `name` varchar(100),
    `birthday` date
)
ENGINE = MergeTree
PRIMARY KEY id

Query id: 5f8f94dc-3db7-429c-b954-32538c859095

Ok.

0 rows in set. Elapsed: 0.057 sec.

localhost :)