- 首頁 >
- 問答 >
-
云計算 >
- clickhouse常用的sql語句有哪些
clickhouse常用的sql語句有哪些
小億
174
2024-03-01 14:44:16
- 查詢表中所有數(shù)據(jù):SELECT * FROM table_name;
- 查詢特定列的數(shù)據(jù):SELECT col1, col2 FROM table_name;
- 查詢滿足條件的數(shù)據(jù):SELECT * FROM table_name WHERE condition;
- 對數(shù)據(jù)進行聚合計算:SELECT SUM(col1), AVG(col2) FROM table_name GROUP BY col3;
- 對數(shù)據(jù)進行排序:SELECT * FROM table_name ORDER BY col1 DESC;
- 對數(shù)據(jù)進行分頁查詢:SELECT * FROM table_name LIMIT 10 OFFSET 20;
- 對數(shù)據(jù)進行聯(lián)合查詢:SELECT * FROM table1 JOIN table2 ON table1.id = table2.id;
- 對數(shù)據(jù)進行去重操作:SELECT DISTINCT col1, col2 FROM table_name;
- 對數(shù)據(jù)進行條件判斷:SELECT col1, CASE WHEN col2 > 100 THEN ‘A’ ELSE ‘B’ END FROM table_name;
- 對數(shù)據(jù)進行時間窗口查詢:SELECT * FROM table_name WHERE timestamp BETWEEN start_time AND end_time;