Skip to main content
PProfileMatch
← Path

Advanced SQL · SQL CTEs and Recursive Queries: Walk Hierarchies with WITH RECURSIVE

0 XP
  1. 1 current stop: learning
  2. 2 upcoming
  3. 3 upcoming
  4. 4 upcoming
  5. 5 upcoming

Finish after stop 5

Stop 1 of 5 · Workshop bench: labelling the parts

Trick to keep in mind+3 XP

A CTE is a name tag on a subquery, not a stored table.

WITH name AS (...) gives an intermediate result a name that the following statement can use like a table, as many times as you like. It exists only for that one statement and writes nothing to the database. It is mainly for readability; whether it runs faster depends on the database and is not something the keyword promises.

Read it once, then a question tests whether the trick stuck.