VALUES
Syntax
VALUES row [, ...]
where row is a single expression or
( column_expression [, ...] )
Description
VALUES is used to query any place that can be used (for example, the FROM clause of SELECT and INSERT). VALUES is used to create an anonymous table without column names, but tables and columns can be named using AS clauses with column aliases.
Example
- To return a table with one column and three rows:
VALUES 1, 2, 3
- To return a table with two columns and three rows:
VALUES (1, 'a'), (2, 'b'), (3, 'c')
- To return the table with the column name id and name:
SELECT * FROM (values (1, 'a'), (2, 'b'),(3, 'c')) AS t (id, name);
- Create a table with the column id and name:
CREATE TABLE example AS SELECT * FROM (VALUES (1, 'a'), (2, 'b'), (3, 'c')) AS t (id, name);
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot