title: Can you define "literal" tables in SQL?
body: <p>Is there any SQL subquery syntax that lets you define, literally, a temporary table?</p>
  
  <p>For example, something like</p>
  
  <pre><code>SELECT
    MAX(count) AS max,
    COUNT(*) AS count
  FROM
    (
      (1 AS id, 7 AS count),
      (2, 6),
      (3, 13),
      (4, 12),
      (5, 9)
    ) AS mytable
    INNER JOIN someothertable ON someothertable.id=mytable.id
  </code></pre>
  
  <p>This would save having to do two or three queries: creating temporary table, putting data in it, then using it in a join.</p>
  
  <p>I am using MySQL but would be interested in other databases that could do something like that.</p>