Definition:

WITH

  • [RECURSIVE]
  • cte_name
    • cte_name names a single common table expression and can be used as a table reference in the statement containing the WITH clause
  • [(col_name [, col_name] …)]
  • AS (subquery)
    • The subquery part of AS (_subquery_) is called the “subquery of the CTE” and is what produces the CTE result set.
    • The parentheses following AS are required.
  • [, cte_name [(col_name [, col_name] …)] AS (subquery)] …