liveBook · Manning

Values clause

As explained in DuckDB in Action

The VALUES clause specifies literal rows and columns that can form a query result or an inline relation.

The VALUES clause creates a fixed number of literal rows. In DuckDB, it works as a standalone query or as an inline relation in FROM, making small seed datasets and temporary join inputs easy to express. section 3.4.4

Use the tuple shape deliberately:

  • VALUES (1, 2); produces one row with two columns. section 3.4.4
  • VALUES (1, 2), (3, 4); produces multiple rows without extra wrapping parentheses. section 3.4.4
  • VALUES ((1, 2), (3, 4)); produces one row whose two columns contain structured values. section 3.4.4

Name an inline relation

SELECT * FROM (VALUES (1, 'Row 1', now()), (2, 'Row 2', now()) ) t(id, name, arbitrary_column_name); section 3.4.4

SELECT *
FROM (VALUES
    (1, 'Row 1', now()),
    (2, 'Row 2', now())
) t(id, name, arbitrary_column_name);

Inspect a runnable inline table with named columns and mixed value types. section 3.4.4

How DuckDB in Action covers it

How deep it goes
Defines row syntax, tuple nesting, structured values, and named inline columns without detailing execution internals.
Examples
Demonstrates single rows, multiple tuples, structured tuples, named inline tables, and literal join inputs.
What it assumes
Assumes familiarity with inserting data and basic SELECT/FROM query structure.
What you can do after
Build inline relations from literal rows and use them as temporary inputs for queries and joins.
How it connects
Connects VALUES to SELECT statements, FROM clauses, joins, and inserting data.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of DuckDB in Action. The section links point to the parts of the book it draws on.