pub struct Select {Show 24 fields
pub select_token: AttachedToken,
pub optimizer_hint: Option<OptimizerHint>,
pub distinct: Option<Distinct>,
pub select_modifiers: Option<SelectModifiers>,
pub top: Option<Top>,
pub top_before_distinct: bool,
pub projection: Vec<SelectItem>,
pub exclude: Option<ExcludeSelectItem>,
pub into: Option<SelectInto>,
pub from: Vec<TableWithJoins>,
pub lateral_views: Vec<LateralView>,
pub prewhere: Option<Expr>,
pub selection: Option<Expr>,
pub connect_by: Vec<ConnectByKind>,
pub group_by: GroupByExpr,
pub cluster_by: Vec<Expr>,
pub distribute_by: Vec<Expr>,
pub sort_by: Vec<OrderByExpr>,
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 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.
Token for the SELECT keyword
SELECT [DISTINCT] ...
MSSQL syntax: TOP (<N>) [ PERCENT ] [ WITH TIES ]
Whether the top was located before ALL/DISTINCT
projection expressions
Excluded columns from the projection expression which are not specified directly after a wildcard.
INTO
FROM
LATERAL VIEWs
ClickHouse syntax: PREWHERE a = 1 WHERE b = 2,
and it can be used together with WHERE selection.
WHERE
[START WITH ..] CONNECT BY ..
GROUP BY
CLUSTER BY (Hive)
DISTRIBUTE BY (Hive)
SORT BY (Hive)
HAVING
WINDOW AS
QUALIFY (Snowflake)
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.
BigQuery syntax: SELECT AS VALUE | SELECT AS STRUCT
Was this a FROM-first query?