The VALUES clause is the ANSI-SQL way to construct one or more rows directly in a statement. It is most often paired with INSERT to add data into a table, but it can also be used as a stand-alone table expression in SELECT queries or common table expressions (CTEs). Each set of parentheses defines a single row. Columns are ordered positionally, and every row must contain the same number of expressions. Expressions can be literals, scalar functions, NULL, DEFAULT (inside INSERT), or parameters. When used outside INSERT, VALUES returns an ephemeral result set that can be joined, filtered, or unioned like any other subquery. Because VALUES is evaluated once per statement, it is faster and more readable than multiple UNION ALL literals. Most modern databases support multi-row VALUES, but some older versions only allow a single row per INSERT.
value_expr
- any scalar expression evaluated for the column positionDEFAULT
- keyword that inserts the column's default value (INSERT only)INSERT, SELECT, ROW constructors, CTE, UNION ALL
SQL-92
VALUES is optimized for defining literal rows inline and usually parses faster than chaining SELECT ... UNION ALL.
Yes. Most dialects (PostgreSQL, SQL Server, etc.) require an alias when VALUES appears in the FROM clause or a CTE.
All expressions in the same column position must be implicitly castable to a common type. Otherwise the database raises a type error.
Yes, starting with MySQL 8.0 you can supply multiple row constructors in a single INSERT statement.