Identifier
|
::= |
<TOKEN_IDENTIFIER> |
NullLiteral
|
::= |
"NULL" |
StringLiteral
|
::= |
<TOKEN_CHAR_LITERAL> |
NumberLiteral
|
::= |
<TOKEN_NUMBER> |
BindVariable
|
::= |
"?" |
TopLevelSQLStatement
|
::= |
SQLStatement |
TopLevelWhereClause
|
::= |
WhereClause <EOF> |
SQLStatement
|
::= |
(UpdateStatement | InsertStatement | DeleteStatement | SelectStatement) <EOF> |
UpdateStatement
|
::= |
"UPDATE" TableReference "SET" UpdateValues (WhereClause)? |
UpdateValues
|
::= |
UpdateValue ( "," UpdateValue)* |
UpdateValue
|
::= |
TableColumn "=" UpdateValueRHS |
UpdateValueRHS
|
::= |
(TableColumn (SQLUnaryExpression)? | SQLLiteralExpression) |
InsertStatement
|
::= |
"INSERT" "INTO" TableReference ( "(" TableColumn ( "," TableColumn)* ")" )? ( "VALUES" "(" SQLLiteralExpression ( "," SQLLiteralExpression)* ")" ) |
DeleteStatement
|
::= |
"DELETE" ( "FROM" )? TableReference (WhereClause)? |
TableColumn
|
::= |
RelObjectName ( "." RelObjectName)? |
RelObjectName
|
::= |
( "LENGTH" | "POSITION" | "PARTITION" | <TOKEN_IDENTIFIER> ) |
Comparison
|
::= |
( "=" | "<>" | ">" | ">=" | "<" | "<=" ) |
TableReference
|
::= |
RelObjectName |
TableReferenceWithAlias
|
::= |
TableReference (AsObjectName)? |
SelectStatement
|
::= |
SelectWithoutOrder (OrderByClause | ForUpdateClause)? |
SelectWithoutOrder
|
::= |
"SELECT" (SelectDistinctOperator | SelectAllOperator) SelectList FromClause WherePlaceHolder (GroupByClause)? (SetContinuation)? |
SelectList
|
::= |
(SelectStar | SelectItemWithAlias ( "," SelectItemWithAlias)* ) |
SelectAllOperator
|
::= |
( "ALL" )? |
SelectDistinctOperator
|
::= |
"DISTINCT" |
SelectStar
|
::= |
"*" |
SelectItemWithAlias
|
::= |
SelectItem (AsObjectName)? |
SelectItem
|
::= |
( <TOKEN_NUMBER> | <TOKEN_CHAR_LITERAL> | SetFunctionCall | SelectAllItems | TableColumn) |
SelectAllItems
|
::= |
RelObjectName "." "*" |
AsObjectName
|
::= |
( "AS" )? <TOKEN_IDENTIFIER> |
FromClause
|
::= |
"FROM" FromItem ( "," FromItem)* |
FromItem
|
::= |
(JoinedPrimaryTable | JoinedPrimaryTableNested) |
JoinedPrimaryTable
|
::= |
TableReferenceWithAlias (JoinClause)* |
JoinedPrimaryTableNested
|
::= |
"(" JoinedPrimaryTableNestedInnerClause ")" (JoinClause)+ |
JoinedPrimaryTableNestedInnerClause
|
::= |
(TableReferenceWithAlias (JoinClause)+ | JoinedPrimaryTableNested) |
JoinClause
|
::= |
LeftJoinSubClause|InnerJoinSubClause |
LeftJoinSubClause
|
::= |
"LEFT" ( "OUTER" )? "JOIN" TableReferenceWithAlias JoinOnClause |
InnerJoinSubClause
|
::= |
( "INNER" )? "JOIN" TableReferenceWithAlias JoinOnClause |
JoinOnClause
|
::= |
"ON" SQLExpression |
WherePlaceHolder
|
::= |
(WhereClause)? |
WhereClause
|
::= |
"WHERE" SQLExpression |
GroupByClause
|
::= |
"GROUP" "BY" SQLExpressionList ( "HAVING" SQLExpression)? |
SetContinuation
|
::= |
( "UNION" ( "ALL" )? | "INTERSECT" | "MINUS" ) ( "(" SelectWithoutOrder ")" | SelectWithoutOrder) |
OrderByClause
|
::= |
"ORDER" "BY" OrderByExpression ( "," OrderByExpression)* |
OrderByExpression
|
::= |
OrderByColumn (OrderByAscendingClause | OrderByDescendingClause)? |
OrderByColumn
|
::= |
RelObjectName ( "." RelObjectName)? |
OrderByAscendingClause
|
::= |
<KEYWORD_ASC> |
OrderByDescendingClause
|
::= |
<KEYWORD_DESC> |
ForUpdateClause
|
::= |
"FOR" "UPDATE" "OF" RelObjectName "." RelObjectName |
SQLExpression
|
::= |
SQLOrExpression |
SQLNotExpression
|
::= |
"NOT" |
SQLOrExpression
|
::= |
SQLAndExpression ( "OR" SQLAndExpression)* |
SQLAndExpression
|
::= |
SQLUnaryLogicalExpressions ( "AND" SQLUnaryLogicalExpressions)* |
SQLUnaryLogicalExpressions
|
::= |
(SQLNotExpression)? (ExistsClause | SQLRelationalExpressions) |
ExistsClause
|
::= |
"EXISTS" "(" SubQuery ")" |
SQLRelationalExpressions
|
::= |
SQLSimpleExpression (SQLRelationalExpression | SQLComparisonExpression)? |
SQLRelationalExpression
|
::= |
( "IS" ( "NOT" )? IsNullClause | ( (SQLNotExpression)? (IsNullClause | SQLInOperator | SQLBetweenOperator | SQLLikeOperator) ) ) |
IsNullClause
|
::= |
( "NULL" | "STRINGNULL" | "DATENULL" | "KEYNULL" ) |
SQLExpressionList
|
::= |
SQLSimpleExpression ( "," SQLSimpleExpression)* |
SQLComparisonExpression
|
::= |
Comparison ( (ComparativeSubQueryType "(" SubQuery ")" ) | SQLSimpleExpression) |
ComparativeSubQueryType
|
::= |
(AnySubQueryType | AllSubQueryType)? |
AnySubQueryType
|
::= |
( "ANY" | "SOME" ) |
AllSubQueryType
|
::= |
"ALL" |
SQLInOperator
|
::= |
"IN" "(" (SQLExpressionList | SubQuery) ")" |
SQLBetweenOperator
|
::= |
"BETWEEN" SQLSimpleExpression "AND" SQLSimpleExpression |
SQLLikeOperator
|
::= |
"LIKE" SQLSimpleExpression (SQLLikeEscapeExpression)? |
SQLLikeEscapeExpression
|
::= |
"ESCAPE" StringLiteral |
SQLSimpleExpression
|
::= |
SQLAdditiveExpression |
SQLAdditiveExpression
|
::= |
SQLMultiplicativeExpression ( ( "+" | "-" | "||" ) SQLAdditiveExpression)? |
SQLMultiplicativeExpression
|
::= |
SQLUnaryExpression ( ( "*" | "/" ) SQLMultiplicativeExpression)? |
SQLUnaryExpression
|
::= |
( "+" | "-" )? SQLPrimaryExpression |
SQLPrimaryExpression
|
::= |
SQLLiteralExpression|FunctionCall|TableColumn|"(" SQLExpression ")"
|
SQLLiteralExpression
|
::= |
(NullLiteral | NumberLiteral | StringLiteral | BindVariable) |
FunctionCall
|
::= |
JavaEnvFunctionCall|ToDateFunctionCall|NowFunctionCall|FormatNowFunctionCall|FormatExpressionFunctionCall|FNullCall|SetFunctionCall|BannedFunctionCall |
SetFunctionCall
|
::= |
( "COUNT" "(" (CountArguments) ")" | "MIN" "(" (GeneralFunctionArguments) ")" | "MAX" "(" (GeneralFunctionArguments) ")" | "SUM" "(" (GeneralFunctionArguments) ")" | "AVG" "(" (GeneralFunctionArguments) ")" ) |
FNullCall
|
::= |
"FNULL" "(" (Identifier "," Identifier "," Identifier) ")" |
BannedFunctionCall
|
::= |
( "BIT_LENGTH" | "CAST" | "CONVERT" | "CURRENT_DATE" | "CURRENT_TIME" | "CURRENT_TIMESTAMP" | "EXTRACT" | "LENGTH" | "LOWER" | "POSITION" | "SUBSTRING" | "TRANSLATE" | "TRIM" | "UPPER" ) "(" (GeneralFunctionArguments) ")" |
CountArguments
|
::= |
SelectStar|(SelectDistinctOperator|SQLPrimaryExpression) |
GeneralFunctionArguments
|
::= |
SelectStar|( (SelectDistinctOperator | SelectAllOperator) SQLExpression) |
JavaEnvFunctionCall
|
::= |
"JAVAENV" "(" (StringLiteral) ")" where StringLiteral is either UserAndGlobalIsolationGroupIds , UserId , or User |
ToDateFunctionCall
|
::= |
"TODATE" "(" (StringLiteral "," StringLiteral ( "," StringLiteral)? ) ")" |
NowFunctionCall
|
::= |
"NOW" "(" (StringLiteral ( "," StringLiteral)? )? ")" |
FormatNowFunctionCall
|
::= |
"FORMAT_NOW" "(" (StringLiteral ( "," StringLiteral)? ) ")" |
FormatExpressionFunctionCall
|
::= |
"FORMAT_EXPRESSION" "(" (StringLiteral "," StringLiteral ( "," StringLiteral)? ) ")" |
SubQuery
|
::= |
SelectWithoutOrder |