How to read a syntax diagram

This section describes the various patterns of syntax used throughout the Databricks Runtime reference.

Base components



Keywords in SQL are always capitalized in this document, but they are case insensitive.


( )
<  >

The SQL language includes round braces ((, )) as well as angled braces (<, >), dots (.), commas (,), and a few other characters. When these characters are present in a syntax diagram you must enter them as is.


LIMIT clause

SELECT named_expression

  expression AS alias

A clause represents a named subsection of syntax. A local clause is described in the same syntax diagram that invokes it. If the clause is common, it links to another section of the Databricks Runtime reference. Some clauses are known by their main keyword and are depicted with a capital keyword followed by clause. Other clauses are always lower case and use underscore (_) where appropriate. Local clauses are fully explained within the following section. All other clauses have a short description with a link to the main page.



Arguments to functions are specified in camelCase. Databricks Runtime describes the meaning of arguments in the Arguments section.

Chain of tokens


Components separated by whitespace must be entered in order, unconditionally, and be separated only by whitespace or comments. Databricks Runtime supports comments of the form /* ... */ (C-style), and -- ..., which extends to end of the line.


Specifies a fork in the syntax.

Mandatory choice


Curly braces { ... } mean you must specify exactly one of the multiple components. Each choice is separated by a |.

Optional choice

[ ASC | DESC ]

Square brackets [ ... ] indicate you can choose at most one of multiple components. Each choice is separated by a |.


{ SELECT expr }

 expr }

Curly braces { ... } specify that you must provide all the embedded components. If a syntax diagram spans multiple lines, this form clarifies that it depicts the same syntax.



Square brackets [...] specify that the enclosed components are optional.


col_option [...]

col_alias [, ...]

{ expr [ AS ] col_alias } [, ...]

The [...] ellipsis notation indicates that you can repeat the immediately preceding component, grouping, or choice multiple times. If the ellipsis is preceded by another character, such as a separated dot [. ...], or a comma [, ...], you must separate each repetition by that character.