Help Center > > Developer Guide> SQL Reference> SQL Syntax> VALUES


Updated at:Mar 13, 2020 GMT+08:00


VALUES computes a row or a set of rows based on given values. It is most commonly used to generate a constant table within a large command.


  • VALUES lists with large numbers of rows should be avoided, as you might encounter out-of-memory failures or poor performance. VALUES appearing within INSERT is a special case, because the desired column types are known from the INSERT's target table, and need not be inferred by scanning the VALUES list. In this case, VALUE can handle larger lists than are practical in other contexts.
  • If more than one row is specified, all the rows must have the same number of elements.


VALUES {( expression [, ...] )} [, ...]
    [ ORDER BY { sort_expression [ ASC | DESC | USING operator ] } [, ...] ]
    [ LIMIT { count | ALL } ]
    [ OFFSET start [ ROW | ROWS ] ]
    [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ];

Parameter Description

  • expression

    Specifies a constant or expression to compute and insert at the indicated place in the resulting table or set of rows.

    In a VALUES list appearing at the top level of an INSERT, an expression can be replaced by DEFAULT to indicate that the destination column's default value should be inserted. DEFAULT cannot be used when VALUES appears in other contexts.

  • sort_expression

    Specifies an expression or integer constant indicating how to sort the result rows.

  • ASC

    Indicates ascending sort order.

  • DESC

    Indicates descending sort order.

  • operator

    Specifies a sorting operator.

  • count

    Specifies the maximum number of rows to return.

  • OFFSET start { ROW | ROWS }

    Specifies the maximum number of returned rows, whereas start specifies the number of rows to skip before starting to return rows.

  • FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY

    The FETCH clause restricts the total number of rows starting from the first row of the return query result, and the default value of count is 1.


See Examples in INSERT.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?

Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel