内联表Inline table

一个使用 VALUES 子句创建的临时表。A temporary table created using a VALUES clause.

语法Syntax

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

参数Parameters

  • expressionexpression

    生成值的一个或多个值、运算符和 SQL 函数的组合。A combination of one or more values, operators and SQL functions that results in a value.

  • table_aliastable_alias

    具有可选列名列表的临时名称。A temporary name with an optional column name list.

    语法: [ AS ] table_name [ ( column_name [ , ... ] ) ]Syntax: [ AS ] table_name [ ( column_name [ , ... ] ) ]

示例Examples

-- single row, without a table alias
SELECT * FROM VALUES ("one", 1);
+----+----+
|col1|col2|
+----+----+
| one|   1|
+----+----+

-- three rows with a table alias
SELECT * FROM VALUES ("one", 1), ("two", 2), ("three", null) AS data(a, b);
+-----+----+
|    a|   b|
+-----+----+
|  one|   1|
|  two|   2|
|three|null|
+-----+----+

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