title: How many rows can the following SQL query return?
body: <p>sql. There is a table T with an id field (optionally unique) that contains N rows. How many rows can the following SQL query return?</p>
  
  <pre><code>select * from T
  inner join (
      select count(*) as cnt from T 
      union all select count(*) as cnt from T
  ) as TA on TA.cnt = T.id
  inner join (
      select count(*) as cnt from T 
      union select count(*) as cnt from T
  ) as TB on TB.cnt = T.id;
  </code></pre>
  
  <p>I have some options: </p>
  
  <ul>
  <li><p>only N rows</p></li>
  <li><p>from 0 to N rows</p></li>
  <li><p>from 2N to 4N rows</p></li>
  </ul>
  
  <p>or can you name some other options ?</p>