Rudolf Adamkovič Personal site


Example: Generating sequences recursively

Notes on using recursive Common Table Expressions (CTEs):

The WITH Clause, SQLite documentation

WITH RECURSIVE seq(n) AS (
  VALUES(1) UNION ALL SELECT n + 1 FROM seq LIMIT 10
)
SELECT * FROM seq;
n
1
2
3
4
5
6
7
8
9
10

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.