Skip to content
Pivot is in early development and is not production ready. See Project status.

VALUES

VALUES constructs rows directly from expressions. It can be a standalone query or supply input rows to another statement.

VALUES (1, 'eu'), (2, 'us');

This returns two rows, each containing an integer and a string.

VALUES (expression [, ...]) [, ...];

Give a derived table and its columns names to reference the values in a query:

SELECT region, count(*) AS events
FROM (VALUES (1, 'eu'), (2, 'us'), (3, 'eu')) AS input(id, region)
GROUP BY region
ORDER BY region;

The result is eu: 2 and us: 1.

For an existing table:

INSERT INTO events (id, region) VALUES (1, 'eu'), (2, 'us');