clickhouse创建表语句
时间: 2023-12-07 08:40:02 浏览: 127
创建表空间语句
以下是ClickHouse创建表的语法和示例:
1. 创建无索引的表格
```sql
CREATE TABLE testNoPK (
id Int32,
name String
) ENGINE = MergeTree()
ORDER BY id;
```
2. 创建带有索引的表格
```sql
CREATE TABLE testPK (
id Int32,
name String,
INDEX name_index (name) TYPE bloom_filter(0.05)
) ENGINE = MergeTree()
ORDER BY id;
```
3. 创建具有类似于查询结果的结构的表,并使用来自的数据填充该表
```sql
CREATE TABLE test AS SELECT * FROM testNoPK;
```
4. 创建具有列说明的表格
```sql
CREATE TABLE testWithComment (
id Int32 COMMENT 'This is the ID column',
name String COMMENT 'This is the name column'
) ENGINE = MergeTree()
ORDER BY id;
```
阅读全文