Common table expression
Appearance
A Common Table Expression (in SQL) is a temporary named result set, derived from a simple query and defined within the execution scope of a SELECT, INSERT, UPDATE, or DELETE statement.
CTE can be thought of as an alternatives to derived tables (subquery), views, and inline user-defined functions.
External links
- Getting in the loop with CTEs
- MSDN tutorial
- Tony Rogerson's Blog entry on how CTE's work and how to do recursion using an adjancey list as an example in Microsoft SQL Server