SQL Flow Field Guide

SELECT (overview)

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

full query pipeline: bind sources, join, filter, group, aggregate, project, distinct, sort, limit

What changes

Input
table sources named in FROM (tables, views, CTEs, derived tables, TVFs, VALUES, external rowsets), variables, parameters
Output or change
result set to the client, or a new table when INTO is present, or variables when SELECT @v = ...

Syntax at a glance

<SELECT statement> ::= [ WITH { [ XMLNAMESPACES , ] [ <common_table_expression> [ , ...n ] ] } ] <query_expression> [ ORDER BY <order_by_expression> ] [ <FOR Clause> ] [ OPTION ( <query_hint> [ , ...n ] ) ]

Work example

A new report needs named output columns from known source rows. SELECT chooses those values and expressions.

Run the sample, then add one expression and alias. Keep the source list explicit while learning the result shape.

Check your work SELECT (overview). The output has the requested columns and one row for each qualifying source row.

Practice SQL

Open in SQL Flow
SELECT Item, Quantity * Price AS Total
FROM (VALUES (N'pen', 2, 3), (N'book', 1, 8)) AS Lines(Item, Quantity, Price)
ORDER BY Total DESC;

Open Microsoft Learn for full syntax, permissions, and details for your version.