clickhouse常用的sql语句有哪些
小亿
179
2024-03-01 14:44:16
- 查询表中所有数据:SELECT * FROM table_name;
- 查询特定列的数据:SELECT col1, col2 FROM table_name;
- 查询满足条件的数据:SELECT * FROM table_name WHERE condition;
- 对数据进行聚合计算:SELECT SUM(col1), AVG(col2) FROM table_name GROUP BY col3;
- 对数据进行排序:SELECT * FROM table_name ORDER BY col1 DESC;
- 对数据进行分页查询:SELECT * FROM table_name LIMIT 10 OFFSET 20;
- 对数据进行联合查询:SELECT * FROM table1 JOIN table2 ON table1.id = table2.id;
- 对数据进行去重操作:SELECT DISTINCT col1, col2 FROM table_name;
- 对数据进行条件判断:SELECT col1, CASE WHEN col2 > 100 THEN ‘A’ ELSE ‘B’ END FROM table_name;
- 对数据进行时间窗口查询:SELECT * FROM table_name WHERE timestamp BETWEEN start_time AND end_time;