Common Table Expressions
A Common Table Expression (CTE) is a temporary named result set, derived from a simple query and defined within the execution scope of a SELECT or INSERT statement. It is similar to a derived table or inline view.
A CTE simplifies many complex queries. It can be used to replace derived tables (subqueries), temporary tables, table variables, and inline user-defined functions.
For more information, see the SQL Reference Guide.