Search notes:

SQL Server - select statement

Selecting into variables

select
  @var = col
from
  table
where
   abc = 17049;

Subqueries

A subquery apparently needs an alias to be able to select from it.
The following does not work:
select * from (
  select 'x' eggs, 'y' why union all
  select 'X' eggs, 'Y' why
);
But this does:
select * from (
  select 'x' eggs, 'y' why union all
  select 'X' eggs, 'Y' why
) NOTE_THIS_ALIAS;

Misc

select is apparently also used to display the values of variables. (Compare with print).

TODO

Null value is eliminated by an aggregate or other SET operation

See also

for xml
top n queries.
full outer joins.
Select with pivot
Select from »temporary data« with the values clause.
declare a variable and assign a select statement's result in one go.
The with clause.
SQL: select statement
In ADO.NET, a result set is typically processed (iterated over) using a derived class from System.Data.Common.DbDataReader.

Index