Union constant value
mysql>
mysql> SELECT POWER(DIGIT,2)
-> FROM (SELECT 0 AS DIGIT UNION SELECT 1 UNION
-> SELECT 2 UNION SELECT 3 UNION
-> SELECT 4 UNION SELECT 5 UNION
-> SELECT 6 UNION SELECT 7 UNION
-> SELECT 8 UNION SELECT 9) AS DIGITS1
-> UNION ALL
-> SELECT POWER(DIGIT,3)
-> FROM (SELECT 0 AS DIGIT UNION SELECT 1 UNION
-> SELECT 2 UNION SELECT 3 UNION
-> SELECT 4 UNION SELECT 5 UNION
-> SELECT 6 UNION SELECT 7 UNION
-> SELECT 8 UNION SELECT 9) AS DIGITS2
-> ORDER BY 1;
+----------------+
| POWER(DIGIT,2) |
+----------------+
| 0 |
| 0 |
| 1 |
| 1 |
| 4 |
| 8 |
| 9 |
| 16 |
| 25 |
| 27 |
| 36 |
| 49 |
| 64 |
| 64 |
| 81 |
| 125 |
| 216 |
| 343 |
| 512 |
| 729 |
+----------------+
20 rows in set (0.00 sec)
Related examples in the same category