pub struct Select {Show 21 fields
pub select_token: AttachedToken,
pub distinct: Option<Distinct>,
pub top: Option<Top>,
pub top_before_distinct: bool,
pub projection: Vec<SelectItem>,
pub into: Option<SelectInto>,
pub from: Vec<TableWithJoins>,
pub lateral_views: Vec<LateralView>,
pub prewhere: Option<Expr>,
pub selection: Option<Expr>,
pub group_by: GroupByExpr,
pub cluster_by: Vec<Expr>,
pub distribute_by: Vec<Expr>,
pub sort_by: Vec<Expr>,
pub having: Option<Expr>,
pub named_window: Vec<NamedWindowDefinition>,
pub qualify: Option<Expr>,
pub window_before_qualify: bool,
pub value_table_mode: Option<ValueTableMode>,
pub connect_by: Option<ConnectBy>,
pub flavor: SelectFlavor,
}
Expand description
A restricted variant of SELECT
(without CTEs/ORDER BY
), which may
appear either as the only body item of a Query
, or as an operand
to a set operation like UNION
.
Fields§
§select_token: AttachedToken
Token for the SELECT
keyword
distinct: Option<Distinct>
SELECT [DISTINCT] ...
top: Option<Top>
MSSQL syntax: TOP (<N>) [ PERCENT ] [ WITH TIES ]
top_before_distinct: bool
Whether the top was located before ALL
/DISTINCT
projection: Vec<SelectItem>
projection expressions
into: Option<SelectInto>
INTO
from: Vec<TableWithJoins>
FROM
lateral_views: Vec<LateralView>
LATERAL VIEWs
prewhere: Option<Expr>
ClickHouse syntax: PREWHERE a = 1 WHERE b = 2
,
and it can be used together with WHERE selection.
selection: Option<Expr>
WHERE
group_by: GroupByExpr
GROUP BY
cluster_by: Vec<Expr>
CLUSTER BY (Hive)
distribute_by: Vec<Expr>
DISTRIBUTE BY (Hive)
sort_by: Vec<Expr>
SORT BY (Hive)
having: Option<Expr>
HAVING
named_window: Vec<NamedWindowDefinition>
WINDOW AS
qualify: Option<Expr>
QUALIFY (Snowflake)
window_before_qualify: bool
The positioning of QUALIFY and WINDOW clauses differ between dialects. e.g. BigQuery requires that WINDOW comes after QUALIFY, while DUCKDB accepts WINDOW before QUALIFY. We accept either positioning and flag the accepted variant.
value_table_mode: Option<ValueTableMode>
BigQuery syntax: SELECT AS VALUE | SELECT AS STRUCT
connect_by: Option<ConnectBy>
STARTING WITH .. CONNECT BY
flavor: SelectFlavor
Was this a FROM-first query?