---
title: VALUES clause
description: Produce an inline temporary table from value expressions with the VALUES clause in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-qry-select-values
---

# `VALUES` clause

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Produces an inline temporary table for use within the query.

## Syntax

```
VALUES {expression | ( expression [, ...] ) } [, ...] [table_alias]

SELECT expression [, ...] [table_alias]
```

## Parameters

* **[expression](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-expression.md)**

  A combination of one or more values, operators and SQL functions that results in a value.

* **[table\_alias](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#table-alias)**

  An optional label to allow the result set to be referenced by name.

Each tuple constitutes a row.

If there is more than one row the number of fields in each tuple must match.

When using the `VALUES` syntax, if no tuples are specified, each expression equates to a single field tuple.

When using the `SELECT` syntax all expressions constitute a single row temporary table.

The nth field of each tuple must share a least common type.
If `table_alias` specifies column names, their number must match the number of expressions per tuple.

The result is a temporary table where each column's type is the least common type of the matching tuples fields.

If the rows have different numbers of columns, Databricks raises [INVALID\_INLINE\_TABLE.NUM\_COLUMNS\_MISMATCH](https://docs.databricks.com/aws/en/error-messages/invalid-inline-table-error-class.md#num_columns_mismatch). If an expression cannot be evaluated at analysis time, Databricks raises [INVALID\_INLINE\_TABLE.CANNOT\_EVALUATE\_EXPRESSION\_IN\_INLINE\_TABLE](https://docs.databricks.com/aws/en/error-messages/invalid-inline-table-error-class.md#cannot_evaluate_expression_in_inline_table).

## Common error conditions

* [INVALID\_INLINE\_TABLE.CANNOT\_EVALUATE\_EXPRESSION\_IN\_INLINE\_TABLE](https://docs.databricks.com/aws/en/error-messages/invalid-inline-table-error-class.md#cannot_evaluate_expression_in_inline_table)
* [INVALID\_INLINE\_TABLE.INCOMPATIBLE\_TYPES\_IN\_INLINE\_TABLE](https://docs.databricks.com/aws/en/error-messages/invalid-inline-table-error-class.md#incompatible_types_in_inline_table)
* [INVALID\_INLINE\_TABLE.NUM\_COLUMNS\_MISMATCH](https://docs.databricks.com/aws/en/error-messages/invalid-inline-table-error-class.md#num_columns_mismatch)

## Examples

```sql
-- single row, without a table alias
> VALUES ("one", 1);
  one    1

-- Multiple rows, one column
> VALUES 1, 2, 3;
 1
 2
 3

-- three rows with a table alias
> SELECT data.a, b
    FROM VALUES ('one', 1),
                ('two', 2),
                ('three', NULL) AS data(a, b);
   one    1
   two    2
 three NULL

-- complex types with a table alias
> SELECT a, b
  FROM VALUES ('one', array(0, 1)),
              ('two', array(2, 3)) AS data(a, b);
 one [0, 1]
 two [2, 3]

-- Using the SELECT syntax
> SELECT 'one', 2
 one 2

-- Rows have different numbers of columns.
> VALUES (1, 2), (3);
  Error: INVALID_INLINE_TABLE
```

## Related articles

* [Query](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-qry-query.md)
* [SELECT](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-qry-select.md)
