PostgreSQL With v9.6 2017/7

WITH句を使って九九を表示してみる。

WITH
kazu1 AS (SELECT generate_series(1, 9) AS 数1),
kazu2 AS (SELECT generate_series(1, 9) AS 数2)
SELECT 数1, 数2, 数1 * 数2 AS kuku FROM kazu1, kazu2

 数1 | 数2 | 九九
-----+-----+------
   1 |   1 |    1
   1 |   2 |    2
   1 |   3 |    3
   1 |   4 |    4
   1 |   5 |    5
   1 |   6 |    6
   1 |   7 |    7
   1 |   8 |    8
   1 |   9 |    9
...
   9 |   1 |    9
   9 |   2 |   18
   9 |   3 |   27
   9 |   4 |   36
   9 |   5 |   45
   9 |   6 |   54
   9 |   7 |   63
   9 |   8 |   72
   9 |   9 |   81
(81 行)