溫馨提示×

clickhouse常用的sql語句有哪些

小億
174
2024-03-01 14:44:16
欄目: 云計算

  1. 查詢表中所有數(shù)據(jù):SELECT * FROM table_name;
  2. 查詢特定列的數(shù)據(jù):SELECT col1, col2 FROM table_name;
  3. 查詢滿足條件的數(shù)據(jù):SELECT * FROM table_name WHERE condition;
  4. 對數(shù)據(jù)進行聚合計算:SELECT SUM(col1), AVG(col2) FROM table_name GROUP BY col3;
  5. 對數(shù)據(jù)進行排序:SELECT * FROM table_name ORDER BY col1 DESC;
  6. 對數(shù)據(jù)進行分頁查詢:SELECT * FROM table_name LIMIT 10 OFFSET 20;
  7. 對數(shù)據(jù)進行聯(lián)合查詢:SELECT * FROM table1 JOIN table2 ON table1.id = table2.id;
  8. 對數(shù)據(jù)進行去重操作:SELECT DISTINCT col1, col2 FROM table_name;
  9. 對數(shù)據(jù)進行條件判斷:SELECT col1, CASE WHEN col2 > 100 THEN ‘A’ ELSE ‘B’ END FROM table_name;
  10. 對數(shù)據(jù)進行時間窗口查詢:SELECT * FROM table_name WHERE timestamp BETWEEN start_time AND end_time;

0