Odeio dizer isso, mas
MySQL é o único RDBMS dos quatro grandes que não tem esse recurso. Em
Oracle :SELECT *
FROM dual
CONNECT BY
level < n
Em
MS SQL (até 100 linhas):WITH hier(row) AS
(
SELECT 1
UNION ALL
SELECT row + 1
FROM hier
WHERE row < n
)
SELECT *
FROM hier
ou usando dica até
32768 WITH hier(row) AS
(
SELECT 1
UNION ALL
SELECT row + 1
FROM hier
WHERE row < 32768
)
SELECT *
FROM hier
OPTION (MAXRECURSION 32767) -- 32767 is the maximum value of the hint
Em
PostgreSQL :SELECT *
FROM generate_series (1, n)
Em
MySQL , nada.