title: Column names for a table formed by a UNION
body: <p>Given a couple of simple tables like so:</p>
  
  <pre><code>create table R(foo text);
  create table S(bar text);
  </code></pre>
  
  <p>If I were to union them together in a query, what do I call the column?</p>
  
  <pre><code>select T.????
  from (
      select foo
      from R
      union
      select bar
      from S) as T;
  </code></pre>
  
  <p>Now, in mysql, I can apparently refer to the column of T as 'foo' -- the name of the matching column for the first relation in the union. In sqlite3, however, that doesn't seem to work. Is there a way to do it that's standard across all SQL implementations?</p>
  
  <p>If not, how about just for sqlite3?</p>
  
  <p>Correction: sqlite3 does allow you to refer to T's column as 'foo' after all! Oops!</p>