VALUES
Synopsis
1. VALUES row [, ...]
where row is a single expression or
1. ( column_expression [, ...] )
Description
Defines a literal inline table.
VALUES can be used anywhere a query can be used (e.g., the FROM clause of a SELECT, an INSERT, or even at the top level). VALUES creates an anonymous table without column names, but the table and columns can be named using an AS clause with column aliases.
Examples
Return a table with one column and three rows:
1. VALUES 1, 2, 3
Return a table with two columns and three rows:
1. VALUES
2. (1, 'a'),
3. (2, 'b'),
4. (3, 'c')
Return table with column id and name:
1. SELECT * FROM (
2. VALUES
3. (1, 'a'),
4. (2, 'b'),
5. (3, 'c')
6. ) AS t (id, name)
Create a new table with column id and name:
1. CREATE TABLE example AS
2. SELECT * FROM (
3. VALUES
4. (1, 'a'),
5. (2, 'b'),
6. (3, 'c')
7. ) AS t (id, name)
