Oracle CONNECT BY clause for hierarchical queries
The select-list: columns, expressions, aliases, and wildcards.
Optionalfor_T-SQL FOR XML clause options (PATH, RAW, AUTO, EXPLICIT, BINARY BASE64, ELEMENTS XSINIL, etc.)
OptionalformatClickHouse FORMAT clause (e.g., FORMAT PrettyCompact)
The FROM clause, containing one or more table sources.
SELECT ... INTO table_name for creating tables
JOIN clauses applied after the FROM source.
OptionalkindBigQuery SELECT AS STRUCT / SELECT AS VALUE kind
Leading comments before the statement
Optionallimit_ClickHouse LIMIT BY clause expressions
FOR UPDATE/SHARE locking clauses
Optionaloperation_MySQL operation modifiers (HIGH_PRIORITY, STRAIGHT_JOIN, SQL_CALC_FOUND_ROWS, etc.)
OptionaloptionTSQL OPTION clause (e.g., OPTION(LABEL = 'foo'))
Optionalpost_Comments that appear after SELECT keyword (before expressions) e.g., SELECT /*hint*/ col -> post_select_comments: ["/*hint*/"]
OptionalprewhereClickHouse PREWHERE clause
Optionalqualify_Whether QUALIFY appears after WINDOW (DuckDB) vs before (Snowflake/BigQuery default)
OptionalsettingsClickHouse SETTINGS clause (e.g., SETTINGS max_threads = 4)
Represent a complete SELECT statement.
This is the most feature-rich AST node, covering the full surface area of SELECT syntax across 30+ SQL dialects. Fields that are
Optionor emptyVecare omitted from the generated SQL when absent.Key Fields
expressions-- the select-list (columns,*, computed expressions).from-- the FROM clause.NoneforSELECT 1style queries.joins-- zero or more JOIN clauses, each with a [JoinKind].where_clause-- the WHERE predicate.group_by-- GROUP BY, including ROLLUP/CUBE/GROUPING SETS.having-- HAVING predicate.order_by-- ORDER BY with ASC/DESC and NULLS FIRST/LAST.limit/offset/fetch-- result set limiting.with-- Common Table Expressions (CTEs).distinct/distinct_on-- DISTINCT and PostgreSQL DISTINCT ON.windows-- named window definitions (WINDOW w AS ...).Dialect-specific extensions are supported via fields like
prewhere(ClickHouse),qualify(Snowflake/BigQuery/DuckDB),connect(Oracle CONNECT BY),for_xml(TSQL), andsettings(ClickHouse).