Search notes:

SQL Server: create test data with the values clause

The values(…) clause is handy to quickly create a bit of test data without creating a table.
The following example tests a left join:
select
   en.num,
   en.txt,
   ge.txt
from (
  values
    (   1, 'one'  ),
    (   2, 'two'  ),
    (   3, 'three'),
    (   4, 'four' )
) en (num,  txt   )    left join
( values
    (   1, 'eins' ),
    (   2, 'zwei' ),
    (   4, 'vier' ),
    (   5, 'fünf' )
) ge (num,  txt   )  on en.num = ge.num;
Github repository about-MSSQL, path: /sql/select/values/left-join.sql

See also

Mimicking Oracle's greatest and least functions with the values clause
select

Index