Skip to main content
Skip to main content

Values Table Function

The Values table function allows you to create temporary storage which fills columns with values. It is useful for quick testing or generating sample data.

Note

Values is a case-insensitive function. I.e. VALUES or values are both valid.

Syntax

The basic syntax of the VALUES table function is:

It is commonly used as:

Arguments

  • column1_name Type1, ... (optional). String specifying the column names and types. If this argument is omitted columns will be named as c1, c2, etc.
  • (value1_row1, value2_row1). Tuples containing values of any type.
Note

Comma separated tuples can be replaced by single values as well. In this case each value is taken to be a new row. See the examples section for details.

Returned value

  • Returns a temporary table containing the provided values.

Examples

VALUES can also be used with single values rather than tuples. For example:

Or without providing a row specification ('column1_name Type1, column2_name Type2, ...' in the syntax), in which case the columns are automatically named.

For example:

See also