Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLCTEs WITHSingle-choice MCQ

In a query that references the same CTE twice, which statement is GUARANTEED by the SQL standard about how that CTE is evaluated?

WITH counted AS ( SELECT id, expensive_fn(id) AS x FROM big_table ) SELECT a.id FROM counted a JOIN counted b ON a.x = b.x;