本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
SELECT
SELECT语句可用于从一个或多个表中检索数据。Timestream 的查询语言支持以下语SELECT句语法:
[ WITH with_query [, ...] ] SELECT [ ALL | DISTINCT ] select_expr [, ...] [ function (expression) OVER ( [ PARTITION BY partition_expr_list ] [ ORDER BY order_list ] [ frame_clause ] ) [ FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY [ ALL | DISTINCT ] grouping_element [, ...] ] [ HAVING condition] [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ] [ ORDER BY order_list ] [ LIMIT [ count | ALL ] ]
其中
-
function (expression)
是支持的窗口功能之一。 -
partition_expr_list
为:expression | column_name [, expr_list ]
-
order_list
为:expression | column_name [ ASC | DESC ] [ NULLS FIRST | NULLS LAST ] [, order_list ]
-
frame_clause
为:ROWS | RANGE { UNBOUNDED PRECEDING | expression PRECEDING | CURRENT ROW } | {BETWEEN { UNBOUNDED PRECEDING | expression { PRECEDING | FOLLOWING } | CURRENT ROW} AND { UNBOUNDED FOLLOWING | expression { PRECEDING | FOLLOWING } | CURRENT ROW }}
-
from_item
是以下之一:table_name [ [ AS ] alias [ ( column_alias [, ...] ) ] ] from_item join_type from_item [ ON join_condition | USING ( join_column [, ...] ) ]
-
join_type
是以下之一:[ INNER ] JOIN LEFT [ OUTER ] JOIN RIGHT [ OUTER ] JOIN FULL [ OUTER ] JOIN
-
grouping_element
是以下之一:() expression