title: SQL BETWEEN for text vs numeric values
body: <p><code>BETWEEN</code> is used in a <code>WHERE</code> clause to select a range of data between two values.<br>
  If I am correct whether the range's endpoint are excluded or not is DBMS specific.<br>
  What I can not understand in the following:<br>
  If I have a table of values and I do the following query:   </p>
  
  <pre><code>SELECT food_name 
      FROM health_foods 
      WHERE calories BETWEEN 33 AND 135;`  
  </code></pre>
  
  <p>The query returns as results rows <strong>including</strong> calories =33 and calories =135 (i.e. range endpoints are <strong>included</strong>).  </p>
  
  <p>But if I do:</p>
  
  <pre><code>SELECT food_name 
      FROM health_foods 
      WHERE food_name BETWEEN 'G' AND 'O';
  </code></pre>
  
  <p>I do <em>not</em> get rows with <code>food_name</code> starting with <code>O</code>. I.e. the end of the range is <strong>excluded</strong>.<br>
  For the query to work as expected I type: </p>
  
  <pre><code>SELECT food_name 
      FROM health_foods 
      WHERE food_name BETWEEN 'G' AND 'P';`   
  </code></pre>
  
  <p>My question is why is there such a difference for <code>BETWEEN</code> for numbers and text data?</p>