A single CTE (used after WITH
): alias [(col1, col2, ...)] AS ( query )
The names in the column list before AS
, 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.
SQL ORDER BY expression
The most complete variant of a SELECT
query expression, optionally
including WITH
, UNION
/ other set operations, and ORDER BY
.
A restricted variant of SELECT
(without CTEs/ORDER BY
), which may
appear either as the only body item of an SQLQuery
, or as an operand
to a set operation like UNION
.