随笔分类 -  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 阅读全文
posted @ 2021-09-02 15:07 muyue123 阅读(97) 评论(0) 推荐(0) 编辑
摘要:方法一: ALTER TABLE kuming.tableName DELETE WHERE toDate(insert_at_timestamp)='2020-07-21'; 方法二: ALTER TABLE kuming.tableName DELETE WHERE insert_at_time 阅读全文
posted @ 2021-08-10 15:36 muyue123 阅读(127) 评论(0) 推荐(0) 编辑
摘要:create table test.t_20210429 ( app String, cnt Nullable(UInt32), per Nullable(UInt32) ) ENGINE=MergeTree() order by app; insert into test.t_20210429 v 阅读全文
posted @ 2021-04-29 18:56 muyue123 阅读(64) 评论(0) 推荐(0) 编辑
摘要:# 分组取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', 阅读全文
posted @ 2021-04-28 14:46 muyue123 阅读(241) 评论(0) 推荐(0) 编辑
摘要:SELECT modulo(10, 3) #求余数 SELECT modulo(10, 3) 阅读全文
posted @ 2021-01-14 18:05 muyue123 阅读(39) 评论(0) 推荐(0) 编辑
摘要:SELECT region, country, category, max(multiIf(rownumber = 1, app, '')) AS col1, max(multiIf(rownumber = 2, app, '')) AS col2, max(multiIf(rownumber = 阅读全文
posted @ 2020-12-07 19:14 muyue123 阅读(86) 评论(0) 推荐(0) 编辑
摘要:导入的CSV文件没有字段名称时: cat csv文件路径 | clickhouse-client --query="INSERT INTO 数据库.表名 FORMAT CSV" 导入的CSV文件有字段名称时: cat csv文件路径 | clickhouse-client --query="INSE 阅读全文
posted @ 2020-10-13 20:23 muyue123 阅读(238) 评论(0) 推荐(0) 编辑
摘要:SELECT now() ┌───────────────now()─┐│ 2020-10-10 02:27:03 │└─────────────────────┘ SELECT today() ┌────today()─┐│ 2020-10-10 │└────────────┘ 阅读全文
posted @ 2020-10-10 10:29 muyue123 阅读(56) 评论(0) 推荐(0) 编辑
摘要:20200915:利用远程mysql创建表时出现报错。 CREATE TABLE test.test_perm ENGINE = MergeTree() ORDER BY app_id AS SELECT * FROM mysql('10.32.0.103:3306', 'test', 'test_ 阅读全文
posted @ 2020-09-15 11:23 muyue123 阅读(234) 评论(0) 推荐(0) 编辑
摘要:MYSQL select * from mysql('10.32.0.103:3306','test','t1','trancare','trancare'); 从MYSQL创建表 create table test.t2 ENGINE=TinyLog() as select * from mysq 阅读全文
posted @ 2020-09-14 20:24 muyue123 阅读(67) 评论(0) 推荐(0) 编辑
摘要:开启多行查询模式: clickhouse-client -m 更改表名: rename table t1 to t2 修改列信息: alter table scott.emp modify column hiredate datetime; limit by 语句: limit 10 by clas 阅读全文
posted @ 2020-08-13 20:30 muyue123 阅读(104) 评论(0) 推荐(0) 编辑