Question: what is the difference between cte temp table and table variable?
Answer: Temp Tables are physically created in the tempdb database. These tables act as the normal table and also can have constraints, an index like normal tables. CTE is a named temporary result set which is used to manipulate the complex sub-queries data. ... You cannot create an index on CTE.