Generate rows

From SQLZOO
Revision as of 14:34, 8 August 2012 by Connor (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here you are shown how to generate rows without the use of tables

schema:scott
 
 

You can use single value SELECT to generate tables

You can use them when you need a small table for your query but you don't have permission to create tables in the database itself.

SELECT x centigrade, x*9/5+32 fahrenheit
  FROM  (SELECT 0 x UNION SELECT 10 UNION SELECT 20
                    UNION SELECT 30 UNION SELECT 40) t
SELECT x centigrade, x*9/5+32 fahrenheit
  FROM (      SELECT  0 x FROM dual
        UNION SELECT 10   FROM dual
        UNION SELECT 20   FROM dual
       UNION SELECT 30   FROM dual
       UNION SELECT 40   FROM dual) t
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense