随笔分类 - clickhouse
摘要:select id,cnt,sum(cnt) over w as sum_cntfrom( select 'a' as id, 1 as cnt union all select 'a' as id, 9 as cnt union all select 'a' as id, 4 as cnt uni
阅读全文
摘要:方法一: ALTER TABLE kuming.tableName DELETE WHERE toDate(insert_at_timestamp)='2020-07-21'; 方法二: ALTER TABLE kuming.tableName DELETE WHERE insert_at_time
阅读全文
摘要:create table test.t_20210429 ( app String, cnt Nullable(UInt32), per Nullable(UInt32) ) ENGINE=MergeTree() order by app; insert into test.t_20210429 v
阅读全文
摘要:# 分组取topn create table t_0428(id UInt32,nm String,cnt UInt32) ENGINE=MergeTree() order by id; insert into t_0428 values(1,'a',100),(1,'b',101),(1,'c',
阅读全文
摘要:SELECT modulo(10, 3) #求余数 SELECT modulo(10, 3)
阅读全文
摘要:SELECT region, country, category, max(multiIf(rownumber = 1, app, '')) AS col1, max(multiIf(rownumber = 2, app, '')) AS col2, max(multiIf(rownumber =
阅读全文
摘要:导入的CSV文件没有字段名称时: cat csv文件路径 | clickhouse-client --query="INSERT INTO 数据库.表名 FORMAT CSV" 导入的CSV文件有字段名称时: cat csv文件路径 | clickhouse-client --query="INSE
阅读全文
摘要:SELECT now() ┌───────────────now()─┐│ 2020-10-10 02:27:03 │└─────────────────────┘ SELECT today() ┌────today()─┐│ 2020-10-10 │└────────────┘
阅读全文
摘要:20200915:利用远程mysql创建表时出现报错。 CREATE TABLE test.test_perm ENGINE = MergeTree() ORDER BY app_id AS SELECT * FROM mysql('10.32.0.103:3306', 'test', 'test_
阅读全文
摘要:MYSQL select * from mysql('10.32.0.103:3306','test','t1','trancare','trancare'); 从MYSQL创建表 create table test.t2 ENGINE=TinyLog() as select * from mysq
阅读全文
摘要:开启多行查询模式: clickhouse-client -m 更改表名: rename table t1 to t2 修改列信息: alter table scott.emp modify column hiredate datetime; limit by 语句: limit 10 by clas
阅读全文