Overview
January 3, 2025About 1 min
Overview
1. Syntax Overview
SELECT ⟨select_list⟩
FROM ⟨tables⟩
[WHERE ⟨condition⟩]
[GROUP BY ⟨groups⟩]
[HAVING ⟨group_filter⟩]
[FILL ⟨fill_methods⟩]
[ORDER BY ⟨order_expression⟩]
[OFFSET ⟨n⟩]
[LIMIT ⟨n⟩];
The IoTDB table model query syntax supports the following clauses:
- SELECT Clause: Specifies the columns to be included in the result. Details: SELECT Clause
- FROM Clause: Indicates the data source for the query, which can be a single table, multiple tables joined using the
JOIN
clause, or a subquery. Details: FROM & JOIN Clause - WHERE Clause: Filters rows based on specific conditions. Logically executed immediately after the
FROM
clause. Details: WHERE Clause - GROUP BY Clause: Used for aggregating data, specifying the columns for grouping. Details: GROUP BY Clause
- HAVING Clause: Applied after the
GROUP BY
clause to filter grouped data, similar toWHERE
but operates after grouping. Details:HAVING Clause - FILL Clause: Handles missing values in query results by specifying fill methods (e.g., previous non-null value or linear interpolation) for better visualization and analysis. Details:FILL Clause
- ORDER BY Clause: Sorts query results in ascending (
ASC
) or descending (DESC
) order, with optional handling for null values (NULLS FIRST
orNULLS LAST
). Details: ORDER BY Clause - OFFSET Clause: Specifies the starting position for the query result, skipping the first
OFFSET
rows. Often used with theLIMIT
clause. Details: LIMIT and OFFSET Clause - LIMIT Clause: Limits the number of rows in the query result. Typically used in conjunction with the
OFFSET
clause for pagination. Details: LIMIT and OFFSET Clause
2. Clause Execution Order
