0%

ClickHouse常用命令

SQL参考 | ClickHouse Docs

数据库

创建数据库

1
CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster] [ENGINE = engine(...)]

查看数据库建库信息

1
show create database db_name

删除数据库

1
DROP DATABASE db_name

创建表

1
CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster](    name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [compression_codec] [TTL expr1],    name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [compression_codec] [TTL expr2],    ...) ENGINE = engine

查看建表信息

1
show create table table_name