Table of Contents

What is the SQL VALUES word?

About

VALUES is a sql expression that construct:

A VALUES expression can be used in all the places where a query can:

Syntax

This is a syntax that may not be implemented for every database

VALUES (1),(2),(3)
VALUES 1, 2, 3 
VALUES (1, 2, 3)
VALUES (1,21),(2,22),(3,23)

Example

JavaDb / Derby

Apache Derby (JavaDB) Reference

create table t(t char(1));
INSERT INTO t SELECT * FROM (VALUES 'a','c','b') t ORDER BY 1;
SELECT *
FROM (VALUES (1,'Unary'),(2,'Binary'),(3,'Ternary'))
AS arity(id,description)

Sql Server

SELECT *
FROM (VALUES (1,'Unary'),(2,'Binary'),(3,'Ternary'))
AS arity(id,description)
1	Unary
2	Binary
3	Ternary