<p>How do I generate a range of consecutive numbers (one per line) from a MySQL query so that I can insert them into a table?</p>

<p>For example:</p>

<pre><code>nr
1
2
3
4
5
</code></pre>

<p>I would like to use only MySQL for this (not PHP or other languages).</p>

```
```
DECLARE i INT DEFAULT 0;

WHILE i < 6 DO
  /* insert into table... */
  SET i = i + 1;
END WHILE;
```
```