Expand description
SQL Abstract Syntax Tree (AST) types
Modules§
Structs§
- Array
- Represents an Array Expression, either
ARRAY[..]
, or[..]
- Array
Agg - An
ARRAY_AGG
invocationARRAY_AGG( [ DISTINCT ] <expr> [ORDER BY <expr>] [LIMIT <n>] )
OrARRAY_AGG( [ DISTINCT ] <expr> ) [ WITHIN GROUP ( ORDER BY <expr> ) ]
ORDER BY position is defined differently for BigQuery, Postgres and Snowflake. - Assignment
- SQL assignment
foo = expr
as used in SQLUpdate - Column
Def - SQL column definition
- Column
Option Def - An optionally-named
ColumnOption
:[ CONSTRAINT <name> ] <column-option>
. - Constraint
Characteristics <constraint_characteristics> = [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] [ ENFORCED | NOT ENFORCED ]
- Create
Function Body - Postgres specific feature.
- Cte
- A single CTE (used after
WITH
):<alias> [(col1, col2, ...)] AS <materialized> ( <query> )
The names in the column list beforeAS
, when specified, replace the names of the columns returned by the query. The parser does not validate that the number of columns in the query matches the number of columns in the query. - Declare
- A
DECLARE
statement. Postgres Snowflake BigQuery - Dictionary
Field - A dictionary field within a dictionary.
- DoUpdate
- Dollar
Quoted String - Drop
Function Desc - Function describe in DROP FUNCTION.
- Except
Select Item - Bigquery
EXCEPT
information, with at least one column. - Fetch
- Function
- A function call
- Hive
Format - Hive
RowDelimiter - Hive
SetLocation - Ident
- An identifier, decomposed into its value or character data and the quote style.
- Ident
With Alias - Single aliased identifier
- Insert
Aliases - Interval
- Represents an INTERVAL expression, roughly in the following format:
INTERVAL '<value>' [ <leading_field> [ (<leading_precision>) ] ] [ TO <last_field> [ (<fractional_seconds_precision>) ] ]
, e.g.INTERVAL '123:45.67' MINUTE(3) TO SECOND(2)
. - Join
- Json
Table Column - A single column definition in MySQL’s
JSON_TABLE
table valued function. - Lateral
View - A hive LATERAL VIEW with potential column aliases
- ListAgg
- A
LISTAGG
invocationLISTAGG( [ DISTINCT ] <expr>[, <separator> ] [ON OVERFLOW <on_overflow>] ) ) [ WITHIN GROUP (ORDER BY <within_group1>[, ...] ) ]
- Lock
Clause - Lock
Table - Macro
Arg NAME = <EXPR>
arguments for DuckDB macros- MapAccess
Key - Expression used to access a value in a nested structure.
- Named
Window Definition - Object
Name - A name of a table, view, custom type, etc., possibly multi-part, i.e. db.schema.obj
- Offset
- OnConflict
- Operate
Function Arg - Function argument in CREATE OR DROP FUNCTION.
- Order
ByExpr - An
ORDER BY
expression - Partition
- PARTITION statement used in ALTER TABLE et al. such as in Hive SQL
- Procedure
Param - Query
- The most complete variant of a
SELECT
query expression, optionally includingWITH
,UNION
/ other set operations, andORDER BY
. - Replace
Select Element - Syntax
- Replace
Select Item - Bigquery
REPLACE
information. - Secret
Option - Select
- A restricted variant of
SELECT
(without CTEs/ORDER BY
), which may appear either as the only body item of aQuery
, or as an operand to a set operation likeUNION
. - Select
Into - SqlOption
- Struct
Field - A field definition within a struct.
- Table
- A
TABLE
command - Table
Alias - Table
With Joins - Top
- User
Defined Type Composite Attribute Def - SQL user defined type attribute definition
- Values
- View
Column Def - Column definition specified in a
CREATE VIEW
statement. - Wildcard
Additional Options - Additional options for wildcards, e.g. Snowflake
EXCLUDE
/RENAME
and BigqueryEXCEPT
. - Window
Frame - Specifies the data processed by a window function, e.g.
RANGE UNBOUNDED PRECEDING
orROWS BETWEEN 5 PRECEDING AND CURRENT ROW
. - Window
Spec - A window specification (i.e.
OVER ([window_name] PARTITION BY .. ORDER BY .. etc.)
) - With
Enums§
- Action
- A privilege on a database object (table, sequence, etc.).
- AddDrop
Sync - Alter
Column Operation - An
ALTER COLUMN
(Statement::AlterTable
) operation - Alter
Index Operation - Alter
Role Operation - An
ALTER ROLE
(Statement::AlterRole
) operation - Alter
Table Operation - An
ALTER TABLE
(Statement::AlterTable
) operation - Analyze
Format - ArgMode
- The mode of an argument in CREATE FUNCTION.
- Array
Elem Type Def - Represents the data type of the elements in an array (if any) as well as the syntax used to declare the array.
- Attach
DuckDB Database Option - Binary
Operator - Binary operators
- Cast
Format - Options for
CAST
/TRY_CAST
BigQuery: https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#formatting_syntax - Char
Length Units - Possible units for characters, initially based on 2016 ANSI standard.
- Character
Length - Information about character length, including length and possibly unit.
- Close
Cursor - Column
Option ColumnOption
s are modifiers that follow a column definition in aCREATE TABLE
statement.- Comment
Object - Conflict
Target - Context
Modifier - Optional context modifier for statements that can be or
LOCAL
, orSESSION
. - Copy
Legacy CsvOption - A
CSV
option inCOPY
statement before PostgreSQL version 9.0. - Copy
Legacy Option - An option in
COPY
statement before PostgreSQL version 9.0. - Copy
Option - An option in
COPY
statement. - Copy
Source - Copy
Target - Create
Function Using - Create
Table Options - Sql options of a
CREATE TABLE
statement. - CteAs
Materialized - Data
Type - SQL data types
- Date
Time Field - Declare
Assignment - Represents an expression assignment within a variable
DECLARE
statement. - Declare
Type - Represents the type of a
DECLARE
statement. - Deferrable
Initial - Describe
Alias - Discard
Object - Distinct
- Drop
Function Option - Function describe in DROP FUNCTION.
- Exact
Number Info - Additional information for
NUMERIC
,DECIMAL
, andDEC
data types following the 2016 standard. - Exclude
Select Item - Snowflake
EXCLUDE
information. - Expr
- An SQL expression of any type.
- Fetch
Direction - Specific direction for FETCH statement
- File
Format - External table’s available file format
- Flush
Location - Flush
Type - ForClause
- FOR XML or FOR JSON clause, specific to MSSQL (formats the output of a query as XML or JSON)
- ForJson
- ForXml
- From
Table - A
FROM
clause within aDELETE
statement. - Function
Arg - Function
ArgExpr - Function
ArgOperator - Operator used to separate function arguments
- Function
Behavior - These attributes inform the query optimizer about the behavior of the function.
- Function
Called OnNull - These attributes describe the behavior of the function when called with a null argument.
- Function
Definition - Function
Parallel - If it is safe for PostgreSQL to call the function from multiple threads at once
- Generated
As GeneratedAs
s are modifiers that follow a column option in agenerated
. ‘ExpStored’ is used for a column generated from an expression and stored.- Generated
Expression Mode GeneratedExpressionMode
s are modifiers that follow an expression in agenerated
. No modifier is typically the same as Virtual.- Grant
Objects - Objects on which privileges are granted in a GRANT statement.
- Group
ByExpr - Hive
Delimiter - Hive
Describe Format - Hive
Distribution Style - HiveIO
Format - Hive
RowFormat - Index
Option - MySQLs index option.
- Index
Type - Indexing method used by that index.
- Join
Constraint - Join
Operator - Json
Operator - JsonOperator
- Json
Table Column Error Handling - Stores the error handling clause of a
JSON_TABLE
table valued function: {NULL | DEFAULT json_string | ERROR} ON {ERROR | EMPTY } - KeyOr
Index Display - Representation whether a definition can can contains the KEY or INDEX keywords with the same meaning.
- Kill
Type - List
AggOn Overflow - The
ON OVERFLOW
clause of a LISTAGG invocation - Lock
Table Type - Lock
Type - Macro
Definition - MapAccess
Syntax - Represents the syntax/style used in a map access.
- Merge
Clause MERGE
Statement- MinMax
Value - Can use to describe options in create sequence or table column type identity [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
- MySQL
Column Position - MySQL
ALTER TABLE
only [FIRST | AFTER column_name] - Mysql
Insert Priority - Mysql specific syntax
- NonBlock
- Null
Treatment - Specifies Ignore / Respect NULL within window functions.
For example
FIRST_VALUE(column2) IGNORE NULLS OVER (PARTITION BY column1)
- Object
Type - Offset
Rows - Stores the keyword after
OFFSET <number>
- OnCommit
- OnConflict
Action - OnInsert
- Password
- Privileges
- Privileges granted in a GRANT statement or revoked in a REVOKE statement.
- Referential
Action <referential_action> = { RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT }
- Rename
Select Item - Snowflake
RENAME
information. - Reset
Config - RESET config option:
- Role
Option - An option in
ROLE
statement. - Schema
Name - Schema possible naming variants (1).
- Search
Modifier - Fulltext search modifiers (1).
- Select
Item - One item of the comma-separated list following
SELECT
- Sequence
Options - Can use to describe options in create sequence or table column type identity
- SetConfig
Value - SET config value option:
- SetExpr
- A node in a tree, representing a “query body” expression, roughly:
SELECT ... [ {UNION|EXCEPT|INTERSECT} SELECT ...]
- SetOperator
- SetQuantifier
- A quantifier for SetOperator.
- Show
Create Object - Show
Statement Filter - Sqlite
OnConflict - Sqlite specific syntax
- Statement
- A top-level statement (SELECT, INSERT, CREATE, etc.)
- Table
Constraint - A table-level constraint, specified in a
CREATE TABLE
or anALTER TABLE ADD <constraint>
statement. - Table
Factor - A table name or a parenthesized subquery with an optional alias
- Table
Version - Timezone
Info - Timestamp and Time data types information about TimeZone formatting.
- TopQuantity
- Transaction
Access Mode - Transaction
Isolation Level - Transaction
Mode - Transaction
Modifier - SQLite specific syntax
- Trim
Where Field - Unary
Operator - Unary operators
- User
Defined Type Representation - SQL user defined type definition
- Value
- Primitive SQL values such as number and string
- Value
Table Mode - BigQuery supports ValueTables which have 2 modes:
SELECT AS STRUCT
SELECT AS VALUE
https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#value_tables - Window
Frame Bound - Specifies WindowFrame’s
start_bound
andend_bound
- Window
Frame Units - Window
Type