VALUES
The VALUES
expression constructs a relation from value expressions.
Syntax
Field | Use |
---|---|
expr | The value of a single column of a single row. |
Details
VALUES
expressions can be used anywhere that SELECT
expressions are valid.
They are most commonly used in INSERT
statements, but they can also stand
alone.
Examples
Using a VALUES
expression as a standalone statement:
VALUES (1, 2, 3), (4, 5, 6);
column1 | column2 | column3
---------+---------+---------
1 | 2 | 3
4 | 5 | 6
Using a VALUES
expression in place of a SELECT
expression:
VALUES (1), (2), (3) ORDER BY column1 DESC LIMIT 2;
column1
---------
3
2
Using a VALUES
expression in an INSERT
statement:
INSERT INTO t VALUES (1, 2), (3, 4);