difference between cte and temp table
Note. 1  Temp Tables are physically created in the Tempdb database. 2  CTE is a named temporary result set which is used to manipulate the complex sub-queries data. 3  Table Variable acts like a variable and exists for a particular batch of query execution.