Skip to main content

VALUES

The VALUES clause is used to specify a fixed number of rows. The VALUES clause can be used as a stand-alone statement, as part of the FROM clause, or as input to an INSERT INTO statement.

Examples​

Generate two rows and directly return them:

SQL
VALUES ('Amsterdam', 1), ('London', 2);
 column1   | column2
-----------+---------
 Amsterdam |       1
 London    |       2

Generate two rows as part of a FROM clause, and rename the columns:

SQL
SELECT *FROM (VALUES ('Amsterdam', 1), ('London', 2)) cities(name, id);
 name      | id
-----------+----
 Amsterdam |  1
 London    |  2

Generate two rows and insert them into a table:

SQL
INSERT INTO citiesVALUES ('Amsterdam', 1), ('London', 2);

Create a table directly from a VALUES clause:

SQL
CREATE TABLE cities AS    SELECT *    FROM (VALUES ('Amsterdam', 1), ('London', 2)) cities(name, id);

Syntax​

Syntax