title: SQL: Select a list of numbers from "nothing"
body: <p>What is a fast/readable way to SELECT a relation from "nothing"  that contains a list of numbers. I want to define which numbers by setting a start and end value. I am using Postgres SQL and SQLite, and would be interested in <strong>generic</strong> solutions that will work on both/many platforms.</p>
  
  <p>Desired output relation:</p>
  
  <pre><code># x
    0
    1
    2
    3
    4
  </code></pre>
  
  <p>I know that I can SELECT a single row from "nothing": <code>SELECT 0,1,2,3,4</code> But this selects the values as columns instead of rows and requires to specify all values in the query instead of only using my start and end values: <code>0</code> and <code>4</code>.</p>
  
  <p>In Postgres you have a special <code>generate_series</code> function for this case:</p>
  
  <pre><code>SELECT * FROM generate_series(0,4) x;
  </code></pre>
  
  <p>This works nicely but is non-standard. I can also imagine some complicated solutions using temporary tables, but I would like to have something generic AND simple like:</p>
  
  <pre><code>SELECT * FROM [0..4]
  </code></pre>
  
  <p>Maybe using the <code>SEQUENCE</code> statement or some magic combination of <code>SELECT 0</code> and <code>SELECT 4</code>?</p>