title: SELECT range of integers in MySQL. Eg. 1,2,3,4,...,n;
body: <p>I need to select range of integer in MySQL. Something like this</p>
  
  <p><code>SELECT RANGE(10,20) AS range;</code></p>
  
  <p>returns</p>
  
  <p><code>10, 11, 12, 13, 14, ..., 20</code></p>
  
  <p><strong>Why?</strong><br>
  I would like to select random phone number from range which is not yet registered. This is idea.</p>
  
  <p><code>SELECT RANGE(100000,999999) AS range FROM phone WHERE phoneNum &lt;> range LIMIT FLOOR(100000 + RAND()*(899999);</code></p>