0001 ---
0002 layout: global
0003 title: Inline Table
0004 displayTitle: Inline Table
0005 license: |
0006 Licensed to the Apache Software Foundation (ASF) under one or more
0007 contributor license agreements. See the NOTICE file distributed with
0008 this work for additional information regarding copyright ownership.
0009 The ASF licenses this file to You under the Apache License, Version 2.0
0010 (the "License"); you may not use this file except in compliance with
0011 the License. You may obtain a copy of the License at
0012
0013 http://www.apache.org/licenses/LICENSE-2.0
0014
0015 Unless required by applicable law or agreed to in writing, software
0016 distributed under the License is distributed on an "AS IS" BASIS,
0017 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0018 See the License for the specific language governing permissions and
0019 limitations under the License.
0020 ---
0021
0022 ### Description
0023
0024 An inline table is a temporary table created using a VALUES clause.
0025
0026 ### Syntax
0027
0028 ```sql
0029 VALUES ( expression [ , ... ] ) [ table_alias ]
0030 ```
0031
0032 ### Parameters
0033
0034 * **expression**
0035
0036 Specifies a combination of one or more values, operators and SQL functions that results in a value.
0037
0038 * **table_alias**
0039
0040 Specifies a temporary name with an optional column name list.
0041
0042 **Syntax:** `[ AS ] table_name [ ( column_name [ , ... ] ) ]`
0043
0044 ### Examples
0045
0046 ```sql
0047 -- single row, without a table alias
0048 SELECT * FROM VALUES ("one", 1);
0049 +----+----+
0050 |col1|col2|
0051 +----+----+
0052 | one| 1|
0053 +----+----+
0054
0055 -- three rows with a table alias
0056 SELECT * FROM VALUES ("one", 1), ("two", 2), ("three", null) AS data(a, b);
0057 +-----+----+
0058 | a| b|
0059 +-----+----+
0060 | one| 1|
0061 | two| 2|
0062 |three|null|
0063 +-----+----+
0064
0065 -- complex types with a table alias
0066 SELECT * FROM VALUES ("one", array(0, 1)), ("two", array(2, 3)) AS data(a, b);
0067 +---+------+
0068 | a| b|
0069 +---+------+
0070 |one|[0, 1]|
0071 |two|[2, 3]|
0072 +---+------+
0073 ```
0074
0075 ### Related Statements
0076
0077 * [SELECT](sql-ref-syntax-qry-select.html)