The following Backus-Naur Form grammar outlines the specific syntactic support for the various ANSI SQL analytic functions, many of which are implemented in Sybase IQ.
<SELECT LIST EXPRESSION> ::= <EXPRESSION> | <GROUP BY EXPRESSION> | <AGGREGATE FUNCTION> | <GROUPING FUNCTION> | <TABLE COLUMN> | <WINDOWED TABLE FUNCTION>
<QUERY SPECIFICATION> ::= <FROM CLAUSE> [ <WHERE CLAUSE> ] [ <GROUP BY CLAUSE> ] [ <HAVING CLAUSE> ] [ <WINDOW CLAUSE> ] [ <ORDER BY CLAUSE> ]
<ORDER BY CLAUSE> ::= <ORDER SPECIFICATION>
<GROUPING FUNCTION> ::= GROUPING <LEFT PAREN> <GROUP BY EXPRESSION> <RIGHT PAREN>
<WINDOWED TABLE FUNCTION> ::= <WINDOWED TABLE FUNCTION TYPE> OVER <WINDOW NAME OR SPECIFICATION>
<WINDOWED TABLE FUNCTION TYPE> ::= <RANK FUNCTION TYPE> <LEFT PAREN> <RIGHT PAREN> | ROW_NUMBER <LEFT PAREN> <RIGHT PAREN> | <WINDOW AGGREGATE FUNCTION>
<RANK FUNCTION TYPE> ::= RANK | DENSE RANK | PERCENT RANK | CUME_DIST
<WINDOW AGGREGATE FUNCTION> ::= <SIMPLE WINDOW AGGREGATE FUNCTION> | <STATISTICAL AGGREGATE FUNCTION>
<AGGREGATE FUNCTION> ::= <DISTINCT AGGREGATE FUNCTION> | <SIMPLE AGGREGATE FUNCTION> | <STATISTICAL AGGREGATE FUNCTION>
<DISTINCT AGGREGATE FUNCTION> ::= <BASIC AGGREGATE FUNCTION TYPE> <LEFT PAREN> <DISTINCT> <EXPRESSION> <RIGHT PAREN> | LIST <LEFT PAREN> DISTINCT <EXPRESSION> [ <COMMA> <DELIMITER> ] [ <ORDER SPECIFICATION> ] <RIGHT PAREN>
<BASIC AGGREGATE FUNCTION TYPE> ::= SUM | MAX | MIN | AVG | COUNT
<SIMPLE AGGREGATE FUNCTION> ::= <SIMPLE AGGREGATE FUNCTION TYPE> <LEFT PAREN> <EXPRESSION> <RIGHT PAREN> | LIST <LEFT PAREN> <EXPRESSION> [ <COMMA> <DELIMITER> ] [ <ORDER SPECIFICATION> ] <RIGHT PAREN>
<SIMPLE AGGREGATE FUNCTION TYPE> ::= <SIMPLE WINDOW AGGREGATE FUNCTION TYPE>
<SIMPLE WINDOW AGGREGATE FUNCTION> ::= <SIMPLE WINDOW AGGREGATE FUNCTION TYPE> <LEFT PAREN> <EXPRESSION> <RIGHT PAREN> | GROUPING FUNCTION
<SIMPLE WINDOW AGGREGATE FUNCTION TYPE> ::= <BASIC AGGREGATE FUNCTION TYPE> | STDDEV | STDDEV_POP | STDDEV_SAMP | VARIANCE | VARIANCE_POP | VARIANCE_SAMP
<STATISTICAL AGGREGATE FUNCTION> ::= <STATISTICAL AGGREGATE FUNCTION TYPE> <LEFT PAREN> <DEPENDENT EXPRESSION> <COMMA> <INDEPENDENT EXPRESSION> <RIGHT PAREN>
<STATISTICAL AGGREGATE FUNCTION TYPE> ::= CORR | COVAR_POP | COVAR_SAMP | REGR_R2 | REGR_INTERCEPT | REGR_COUNT | REGR_SLOPE | REGR_SXX | REGR_SXY | REGR_SYY | REGR_AVGY | REGR_AVGX
<WINDOW NAME OR SPECIFICATION> ::= <WINDOW NAME> | <IN-LINE WINDOW SPECIFICATION>
<WINDOW NAME> ::= <IDENTIFIER>
<IN-LINE WINDOW SPECIFICATION> ::= <WINDOW SPECIFICATION>
<WINDOW CLAUSE> ::= <WINDOW WINDOW DEFINITION LIST>
<WINDOW DEFINITION LIST> ::= <WINDOW DEFINITION> [ { <COMMA> <WINDOW DEFINITION> } . . . ]
<WINDOW DEFINITION> ::= <NEW WINDOW NAME> AS <WINDOW SPECIFICATION>
<NEW WINDOW NAME> ::= <WINDOW NAME>
<WINDOW SPECIFICATION> ::= <LEFT PAREN> <WINDOW SPECIFICATION> <DETAILS> <RIGHT PAREN>
<WINDOW SPECIFICATION DETAILS> ::= [ <EXISTING WINDOW NAME> ] [ <WINDOW PARTITION CLAUSE> ] [ <WINDOW ORDER CLAUSE> ] [ <WINDOW FRAME CLAUSE> ]
<EXISTING WINDOW NAME> ::= <WINDOW NAME>
<WINDOW PARTITION CLAUSE> ::= PARTITION BY <WINDOW PARTITION EXPRESSION LIST>
<WINDOW PARTITION EXPRESSION LIST> ::= <WINDOW PARTITION EXPRESSION> [ { <COMMA> <WINDOW PARTITION EXPRESSION> } . . . ]
<WINDOW PARTITION EXPRESSION> ::= <EXPRESSION>
<WINDOW ORDER CLAUSE> ::= <ORDER SPECIFICATION>
<WINDOW FRAME CLAUSE> ::= <WINDOW FRAME UNIT> <WINDOW FRAME EXTENT>
<WINDOW FRAME UNIT> ::= ROWS | RANGE
<WINDOW FRAME EXTENT> ::= <WINDOW FRAME START> | <WINDOW FRAME BETWEEN>
<WINDOW FRAME START> ::= UNBOUNDED PRECEDING | <WINDOW FRAME PRECEDING> | CURRENT ROW
<WINDOW FRAME PRECEDING> ::= <UNSIGNED VALUE SPECIFICATION> PRECEDING
<WINDOW FRAME BETWEEN> ::= BETWEEN <WINDOW FRAME BOUND 1> AND <WINDOW FRAME BOUND 2>
<WINDOW FRAME BOUND 1> ::= <WINDOW FRAME BOUND>
<WINDOW FRAME BOUND 2> ::= <WINDOW FRAME BOUND>
<WINDOW FRAME BOUND> ::= <WINDOW FRAME START> | UNBOUNDED FOLLOWING | <WINDOW FRAME FOLLOWING>
<WINDOW FRAME FOLLOWING> ::= <UNSIGNED VALUE SPECIFICATION> FOLLOWING
<GROUP BY EXPRESSION> ::= <EXPRESSION>
<SIMPLE GROUP BY TERM> ::= <GROUP BY EXPRESSION> | <LEFT PAREN> <GROUP BY EXPRESSION> <RIGHT PAREN> | <LEFT PAREN> <RIGHT PAREN>
<SIMPLE GROUP BY TERM LIST> ::= <SIMPLE GROUP BY TERM> [ { <COMMA> <SIMPLE GROUP BY TERM> } . . . ]
<COMPOSITE GROUP BY TERM> ::= <LEFT PAREN> <SIMPLE GROUP BY TERM> [ { <COMMA> <SIMPLE GROUP BY TERM> } . . . ] <RIGHT PAREN>
<ROLLUP TERM> ::= ROLLUP <COMPOSITE GROUP BY TERM>
<CUBE TERM> ::= CUBE <COMPOSITE GROUP BY TERM>
<GROUP BY TERM> ::= <SIMPLE GROUP BY TERM> | <COMPOSITE GROUP BY TERM> | <ROLLUP TERM> | <CUBE TERM>
<GROUP BY TERM LIST> ::= <GROUP BY TERM> [ { <COMMA> <GROUP BY TERM> } . . . ]
<GROUP BY CLAUSE> ::= GROUP BY <GROUPING SPECIFICATION>
<GROUPING SPECIFICATION> ::= <GROUP BY TERM LIST> | <SIMPLE GROUP BY TERM LIST> WITH ROLLUP | <SIMPLE GROUP BY TERM LIST> WITH CUBE | <GROUPING SETS SPECIFICATION>
<GROUPING SETS SPECIFICATION> ::= GROUPING SETS <LEFT PAREN> <GROUP BY TERM LIST> <RIGHT PAREN>
<ORDER SPECIFICATION> ::= ORDER BY <SORT SPECIFICATION LIST>