What does the query return?
WITH RECURSIVE n(x) AS ( SELECT 1 UNION ALL SELECT x * 2 FROM n WHERE x < 20 ) SELECT MAX(x) FROM n;
- 16
- 32
- 64
- 20
The CTE yields 1, 2, 4, 8, 16, 32: the row 16 still passes
Play SQL & Databases ▸
x < 20, so 32 is produced before recursion stops.