What does it mean to SELECT a number?
<p>I'm looking at an example in my book, <em>SQL Antipatterns</em>. The example table is</p>

<pre><code>         TreePaths
==============================
    ancestor | descendant
------------------------------
       1          1
       1          2 
       1          3
       1          4
       1          5
       1          6
       1          7
       2          2
       2          3
       3          3
       4          4
       4          5
       4          6
       4          7
       5          5
       6          6
       6          7
       7          7
</code></pre>

<p>and query I'm confused about it</p>

<pre><code>INSERT INTO TreePaths (ancestor, descendant)
   SELECT t.ancestor, 8
   FROM TreePaths AS t
   WHERE t.descendant = 5
 UNION ALL
   SELECT 8,8
</code></pre>

<p>So let me first undersand the sub-query</p>

<pre><code>SELECT t.ancestor, 8
FROM TreePaths AS t
WHERE t.descendant = 5
</code></pre>

<p>This should return</p>

<pre><code>t.ancestor  |   ???? 
---------------------
   5              ?
   5              ?
   5              ?
</code></pre>

<p>I thought </p>

<pre><code>SELECT x, y
</code></pre>

<p>meant that <code>x</code> and <code>y</code> are names or columns, and <code>8</code> is not a name of a column. What the heck is going on here?</p>