温馨提示×

clickhouse常用的sql语句有哪些

小亿
177
2024-03-01 14:44:16
栏目: 云计算

  1. 查询表中所有数据:SELECT * FROM table_name;
  2. 查询特定列的数据:SELECT col1, col2 FROM table_name;
  3. 查询满足条件的数据:SELECT * FROM table_name WHERE condition;
  4. 对数据进行聚合计算:SELECT SUM(col1), AVG(col2) FROM table_name GROUP BY col3;
  5. 对数据进行排序:SELECT * FROM table_name ORDER BY col1 DESC;
  6. 对数据进行分页查询:SELECT * FROM table_name LIMIT 10 OFFSET 20;
  7. 对数据进行联合查询:SELECT * FROM table1 JOIN table2 ON table1.id = table2.id;
  8. 对数据进行去重操作:SELECT DISTINCT col1, col2 FROM table_name;
  9. 对数据进行条件判断:SELECT col1, CASE WHEN col2 > 100 THEN ‘A’ ELSE ‘B’ END FROM table_name;
  10. 对数据进行时间窗口查询:SELECT * FROM table_name WHERE timestamp BETWEEN start_time AND end_time;

0