▸_sqlgym

1. Generate a Number Sequence

EasyRecursive CTEsWITH RECURSIVEanchor + recursive member

A recursive CTE has two parts joined by UNION ALL: an anchor member (the seed row) and a recursive member that references the CTE itself, running until it produces no more rows.

The table params holds a single value n.

Task: return a single column num containing every integer from 1 to n (inclusive), ordered ascending.

Tables
Loading schema…
Expected outputrows must come back in this order
Computing expected output…

This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases 5test cases in all. A sloppy query that only fits the example won't pass.

SQL
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.
← PrevListNext →