Answer: The common table expression (CTE) is a temporary named result set that you can reference within a SELECT, INSERT, UPDATE, or DELETE statement.
A CTE is defined with two parts:
A WITH clause containing a SELECT statement that generates a valid table
An outer SELECT statement that references the table expression.
The basic syntax structure for a CTE is:
WITH expression_name [ ( column_name [,...n] ) ]
AS
( CTE_query_definition )
SELECT <column_list> FROM expression_name;
Found interesting? Add this to: