- Without keyword
recursive - No
joinin recursive branch—use comma-join (,) - Without column list:
WITH RECURSIVE query_name AS (SELECT...)
The with recursive clause allows a query to refer to its own output:
WITH RECURSIVE query_name (column_name, ...) AS (
SELECT ...
FROM ...
UNION ALL
SELECT ...
FROM query_name -- <= Note the self-reference here
) [, ...]
SELECT ...
FROM query_nameRelated
Tutorial:
With— Organize Complex QueriesOther forms:
cycle ... set ... to ... default ... using,with,within subquery,with recursivein subquery.Product specific forms:
connect by.
Normative References
The with recursive clause is defined in ISO/IEC 9075-2:2023 §7.17 as part of optional feature T131, "Recursive query".