DUAL

DUAL 是一个单列的“虚拟”表,只有一条记录,记录的值为 X;例如:

=> SELECT * FROM DUAL;
 dummy
-------
 X
(1 row)

您可以编写以下类型的查询:

=> SELECT 1 FROM dual;
 ?column?
----------
        1
(1 row)
=> SELECT current_timestamp, current_user FROM dual;
           ?column?            | current_user
-------------------------------+--------------
 2010-03-08 12:57:32.065841-05 | release
(1 row)
=> CREATE TABLE t1(col1 VARCHAR(20), col2 VARCHAR(2));
=> INSERT INTO T1(SELECT 'hello' AS col1, 1 AS col2 FROM dual);)
=> SELECT * FROM t1;
 col1  | col2
-------+------
 hello | 1
(1 row

限制

不能为 DUAL 创建 投影