Notation
The syntax of the SQL language specified in this guide uses a variation of the BNF notation. Specific features of the notation include:
- Keywords written in upper case must be written exactly as shown.
- Keywords written in lower case represents a syntactic entity or production rule.
- Vertical bars '|' are used to separate alternatives.
- Square brackets '[' and ']' are used to indicate optional items. One or more items inside the square bracket may be separated by a vertical bar '|' indicating that the optional set consists of one or more items, from which no more than one item is chosen.
- An asterisk '*' following a closing square bracket ']' indicates that the optional sequence may be repeated any number of times.
- Braces '{' and '}' are used to indicate a set of 2 or more items, from which exactly 1 must be chosen.
- Double braces {{ and }} are used to indicate the location of braces in the syntax and not the start of an item set.
- All other characters must appear as written in the syntax rule.
By way of an example consider the following syntax rule for bool-condition:
boolean-term [ OR boolean-term ]*
The syntax rules shows that a boolean-condition consists of one or more boolean-terms separated by the OR operator.
A further example can be found in the syntax rule for expr-primary-fold:
{ UPPER | LOWER } ( expression )
The rule uses braces '{' and '}' to show that a fold function consists of either the keyword UPPER or LOWER.