A common table expression (CTE) is a temporary named result set. CTE can be used within other DML statements like SELECT, INSERT, UPDATE, and DELETE.
It is not stored as an object and its lifetime is limited to the query.
It is defined using the WITH statement as the following example shows:
A CTE can be used in place of a view in some instances.