WithimpliesrecursiveWithquery names are visible in accessed viewsWithnames even mask qualified table names (schema.table)- Without column list:
WITH name AS (SELECT…) - CTE in subquery cannot see global CTEs
- Query names in
withdon’t hide schema objects
The with clause can be used in subqueries to define even more locally scoped “views”:
SELECT …
FROM ( WITH …
SELECT …
FROM …
) table_nameRelated
Tutorial:
With— Organize Complex QueriesOther forms:
withat top-level,with recursive,with recursivein subquery.Product specific forms:
withbeforeinsert, DML inwith.
Normative References
The with recursive clause in subqueries is defined in ISO/IEC 9075-2:2023 §7.17 as optional feature T122, “WITH (excluding RECURSIVE) in subquery”.

